fortplot_coordinates Module

Coordinate transformation utilities (SOLID principles compliance)

This module handles coordinate transformations, projections, and coordinate system management, separated for better modularity.



Subroutines

public subroutine transform_annotation_coordinates(self, x, y, coord_type, pixel_x, pixel_y)

Transform annotation coordinates based on coordinate type (Issue #184)

Arguments

Type IntentOptional 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

public subroutine transform_quad_to_screen(self, x_quad, y_quad, x_screen, y_screen)

Transform quad coordinates to screen coordinates

Arguments

Type IntentOptional 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)

public subroutine normalize_coordinate_value(value, min_val, max_val, normalized_value)

Normalize a coordinate value to [0,1] range

Arguments

Type IntentOptional 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

public subroutine project_normalized_3d_data(x_norm, y_norm, z_norm, x2d, y2d)

Project normalized 3D data to 2D using default viewing angles

Arguments

Type IntentOptional 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(:)

public subroutine setup_3d_coordinate_system(self, x2d, y2d, orig_x_min, orig_x_max, orig_y_min, orig_y_max)

Setup coordinate system for 3D projection rendering

Arguments

Type IntentOptional 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

public subroutine calculate_projection_bounds(x2d, y2d, proj_x_min, proj_x_max, proj_y_min, proj_y_max)

Calculate bounds of projected 2D data

Arguments

Type IntentOptional 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

public subroutine save_and_set_backend_coordinates(self, proj_x_min, proj_x_max, proj_y_min, proj_y_max, orig_x_min, orig_x_max, orig_y_min, orig_y_max)

Save original coordinates and set new backend coordinate system

Arguments

Type IntentOptional 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

public subroutine restore_original_coordinate_system(self, orig_x_min, orig_x_max, orig_y_min, orig_y_max)

Restore original coordinate system after 3D rendering

Arguments

Type IntentOptional 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