Polar coordinate transformation and utilities
Provides coordinate transforms between polar (theta, r) and Cartesian (x, y) and utilities for polar plot rendering including angular tick generation.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=wp), | public, | parameter | :: | PI | = | 3.14159265358979323846_wp | |
| real(kind=wp), | public, | parameter | :: | TWO_PI | = | 6.28318530717958647693_wp | |
| real(kind=wp), | public, | parameter | :: | DEG_TO_RAD | = | PI/180.0_wp | |
| real(kind=wp), | public, | parameter | :: | RAD_TO_DEG | = | 180.0_wp/PI |
Normalize angle to [0, 2*pi) range
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | theta |
Format angle in degrees as a label string
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | degrees |
Convert single polar coordinate to Cartesian theta: angle in radians r: radius theta_offset: angular offset (default: pi/2 = 90 deg, 0 at top) clockwise: if true, angles increase clockwise
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | theta | |||
| real(kind=wp), | intent(in) | :: | r | |||
| real(kind=wp), | intent(out) | :: | x | |||
| real(kind=wp), | intent(out) | :: | y | |||
| real(kind=wp), | intent(in), | optional | :: | theta_offset | ||
| logical, | intent(in), | optional | :: | clockwise |
Convert arrays of polar coordinates to Cartesian
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | theta(:) | |||
| real(kind=wp), | intent(in) | :: | r(:) | |||
| real(kind=wp), | intent(out) | :: | x(:) | |||
| real(kind=wp), | intent(out) | :: | y(:) | |||
| real(kind=wp), | intent(in), | optional | :: | theta_offset | ||
| logical, | intent(in), | optional | :: | clockwise |
Convert Cartesian to polar coordinates Returns theta in [0, 2*pi) range
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | x | |||
| real(kind=wp), | intent(in) | :: | y | |||
| real(kind=wp), | intent(out) | :: | theta | |||
| real(kind=wp), | intent(out) | :: | r |
Compute angular tick positions and labels for polar plot Returns angles in radians and labels in degrees
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | n_ticks | |||
| real(kind=wp), | intent(out) | :: | tick_angles(:) | |||
| character(len=*), | intent(out) | :: | tick_labels(:) |
Compute radial tick positions for polar plot
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | r_min | |||
| real(kind=wp), | intent(in) | :: | r_max | |||
| integer, | intent(in) | :: | n_ticks | |||
| real(kind=wp), | intent(out) | :: | tick_values(:) |