Coordinate transformation utilities (SOLID principles compliance)
This module handles coordinate transformations, projections, and coordinate system management, separated for better modularity.
Transform annotation coordinates based on coordinate type (Issue #184)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(figure_t), | intent(in) | :: | self | |||
real(kind=wp), | intent(in) | :: | x | |||
real(kind=wp), | intent(in) | :: | y | |||
integer, | intent(in) | :: | coord_type | |||
real(kind=wp), | intent(out) | :: | pixel_x | |||
real(kind=wp), | intent(out) | :: | pixel_y |
Transform quad coordinates to screen coordinates
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(figure_t), | intent(in) | :: | self | |||
real(kind=wp), | intent(in) | :: | x_quad(4) | |||
real(kind=wp), | intent(in) | :: | y_quad(4) | |||
real(kind=wp), | intent(out) | :: | x_screen(4) | |||
real(kind=wp), | intent(out) | :: | y_screen(4) |
Normalize a coordinate value to [0,1] range
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in) | :: | value | |||
real(kind=wp), | intent(in) | :: | min_val | |||
real(kind=wp), | intent(in) | :: | max_val | |||
real(kind=wp), | intent(out) | :: | normalized_value |
Project normalized 3D data to 2D using default viewing angles
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in) | :: | x_norm(:) | |||
real(kind=wp), | intent(in) | :: | y_norm(:) | |||
real(kind=wp), | intent(in) | :: | z_norm(:) | |||
real(kind=wp), | intent(out) | :: | x2d(:) | |||
real(kind=wp), | intent(out) | :: | y2d(:) |
Setup coordinate system for 3D projection rendering
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(figure_t), | intent(inout) | :: | self | |||
real(kind=wp), | intent(in) | :: | x2d(:) | |||
real(kind=wp), | intent(in) | :: | y2d(:) | |||
real(kind=wp), | intent(out) | :: | orig_x_min | |||
real(kind=wp), | intent(out) | :: | orig_x_max | |||
real(kind=wp), | intent(out) | :: | orig_y_min | |||
real(kind=wp), | intent(out) | :: | orig_y_max |
Calculate bounds of projected 2D data
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in) | :: | x2d(:) | |||
real(kind=wp), | intent(in) | :: | y2d(:) | |||
real(kind=wp), | intent(out) | :: | proj_x_min | |||
real(kind=wp), | intent(out) | :: | proj_x_max | |||
real(kind=wp), | intent(out) | :: | proj_y_min | |||
real(kind=wp), | intent(out) | :: | proj_y_max |
Save original coordinates and set new backend coordinate system
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(figure_t), | intent(inout) | :: | self | |||
real(kind=wp), | intent(in) | :: | proj_x_min | |||
real(kind=wp), | intent(in) | :: | proj_x_max | |||
real(kind=wp), | intent(in) | :: | proj_y_min | |||
real(kind=wp), | intent(in) | :: | proj_y_max | |||
real(kind=wp), | intent(in) | :: | orig_x_min | |||
real(kind=wp), | intent(in) | :: | orig_x_max | |||
real(kind=wp), | intent(in) | :: | orig_y_min | |||
real(kind=wp), | intent(in) | :: | orig_y_max |
Restore original coordinate system after 3D rendering
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(figure_t), | intent(inout) | :: | self | |||
real(kind=wp), | intent(in) | :: | orig_x_min | |||
real(kind=wp), | intent(in) | :: | orig_x_max | |||
real(kind=wp), | intent(in) | :: | orig_y_min | |||
real(kind=wp), | intent(in) | :: | orig_y_max |