fortplot_3d_axes Module

3D axes rendering module for projecting 3D axis frames to 2D

Provides routines for generating 3D bounding boxes, axis lines, tick positions and projecting them to 2D coordinates



Subroutines

public subroutine create_3d_axis_corners(x_min, x_max, y_min, y_max, z_min, z_max, corners_3d)

Generate 8 corners of 3D bounding box

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: x_min
real(kind=wp), intent(in) :: x_max
real(kind=wp), intent(in) :: y_min
real(kind=wp), intent(in) :: y_max
real(kind=wp), intent(in) :: z_min
real(kind=wp), intent(in) :: z_max
real(kind=wp), intent(out) :: corners_3d(3,8)

public subroutine project_3d_corners_to_2d(corners_3d, azim, elev, dist, corners_2d)

Project 8 3D corners to 2D screen coordinates

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: corners_3d(3,8)
real(kind=wp), intent(in) :: azim
real(kind=wp), intent(in) :: elev
real(kind=wp), intent(in) :: dist
real(kind=wp), intent(out) :: corners_2d(2,8)

public subroutine create_3d_axis_lines(x_min, x_max, y_min, y_max, z_min, z_max, axis_lines_3d)

Generate 3D axis lines (X, Y, Z axes)

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: x_min
real(kind=wp), intent(in) :: x_max
real(kind=wp), intent(in) :: y_min
real(kind=wp), intent(in) :: y_max
real(kind=wp), intent(in) :: z_min
real(kind=wp), intent(in) :: z_max
real(kind=wp), intent(out) :: axis_lines_3d(3,6)

public subroutine project_3d_axis_lines(axis_lines_3d, azim, elev, dist, axis_lines_2d)

Project 3D axis lines to 2D screen coordinates

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: axis_lines_3d(3,6)
real(kind=wp), intent(in) :: azim
real(kind=wp), intent(in) :: elev
real(kind=wp), intent(in) :: dist
real(kind=wp), intent(out) :: axis_lines_2d(2,6)

public subroutine create_3d_tick_positions(x_min, x_max, y_min, y_max, z_min, z_max, tick_3d, n_ticks)

Generate 3D tick mark positions on axes

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: x_min
real(kind=wp), intent(in) :: x_max
real(kind=wp), intent(in) :: y_min
real(kind=wp), intent(in) :: y_max
real(kind=wp), intent(in) :: z_min
real(kind=wp), intent(in) :: z_max
real(kind=wp), intent(out) :: tick_3d(3,10)
integer, intent(out) :: n_ticks

public subroutine draw_3d_axes_to_raster(ctx, x_min, x_max, y_min, y_max, z_min, z_max)

Draw 3D axes frame to raster backend - matplotlib style

Arguments

Type IntentOptional Attributes Name
class(plot_context), intent(inout) :: ctx
real(kind=wp), intent(in) :: x_min
real(kind=wp), intent(in) :: x_max
real(kind=wp), intent(in) :: y_min
real(kind=wp), intent(in) :: y_max
real(kind=wp), intent(in) :: z_min
real(kind=wp), intent(in) :: z_max

public subroutine transform_corners_to_screen(corners_2d, ctx, x_min, x_max, y_min, y_max, z_min, z_max)

Transform projected corners from data space to screen space

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(inout) :: corners_2d(:,:)
class(plot_context), intent(in) :: ctx
real(kind=wp), intent(in) :: x_min
real(kind=wp), intent(in) :: x_max
real(kind=wp), intent(in) :: y_min
real(kind=wp), intent(in) :: y_max
real(kind=wp), intent(in) :: z_min
real(kind=wp), intent(in) :: z_max