fortplot_contour_algorithms Module

Contour plotting algorithms module

This module implements the marching squares algorithm and related functions for contour line extraction and rendering.



Subroutines

public subroutine calculate_marching_squares_config(z1, z2, z3, z4, level, config)

Calculate marching squares configuration for a cell

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: z1
real(kind=wp), intent(in) :: z2
real(kind=wp), intent(in) :: z3
real(kind=wp), intent(in) :: z4
real(kind=wp), intent(in) :: level
integer, intent(out) :: config

public subroutine get_contour_lines(config, x1, y1, x2, y2, x3, y3, x4, y4, z1, z2, z3, z4, level, line_points, num_lines)

Extract contour lines from a cell using marching squares

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: config
real(kind=wp), intent(in) :: x1
real(kind=wp), intent(in) :: y1
real(kind=wp), intent(in) :: x2
real(kind=wp), intent(in) :: y2
real(kind=wp), intent(in) :: x3
real(kind=wp), intent(in) :: y3
real(kind=wp), intent(in) :: x4
real(kind=wp), intent(in) :: y4
real(kind=wp), intent(in) :: z1
real(kind=wp), intent(in) :: z2
real(kind=wp), intent(in) :: z3
real(kind=wp), intent(in) :: z4
real(kind=wp), intent(in) :: level
real(kind=wp), intent(out) :: line_points(8)
integer, intent(out) :: num_lines

public subroutine interpolate_edge_crossings(x1, y1, x2, y2, x3, y3, x4, y4, z1, z2, z3, z4, level, xa, ya, xb, yb, xc, yc, xd, yd)

Interpolate the positions where contour crosses cell edges

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: x1
real(kind=wp), intent(in) :: y1
real(kind=wp), intent(in) :: x2
real(kind=wp), intent(in) :: y2
real(kind=wp), intent(in) :: x3
real(kind=wp), intent(in) :: y3
real(kind=wp), intent(in) :: x4
real(kind=wp), intent(in) :: y4
real(kind=wp), intent(in) :: z1
real(kind=wp), intent(in) :: z2
real(kind=wp), intent(in) :: z3
real(kind=wp), intent(in) :: z4
real(kind=wp), intent(in) :: level
real(kind=wp), intent(out) :: xa
real(kind=wp), intent(out) :: ya
real(kind=wp), intent(out) :: xb
real(kind=wp), intent(out) :: yb
real(kind=wp), intent(out) :: xc
real(kind=wp), intent(out) :: yc
real(kind=wp), intent(out) :: xd
real(kind=wp), intent(out) :: yd

public subroutine apply_marching_squares_lookup(config, xa, ya, xb, yb, xc, yc, xd, yd, line_points, num_lines)

Apply marching squares lookup table to get line segments

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: config
real(kind=wp), intent(in) :: xa
real(kind=wp), intent(in) :: ya
real(kind=wp), intent(in) :: xb
real(kind=wp), intent(in) :: yb
real(kind=wp), intent(in) :: xc
real(kind=wp), intent(in) :: yc
real(kind=wp), intent(in) :: xd
real(kind=wp), intent(in) :: yd
real(kind=wp), intent(out) :: line_points(8)
integer, intent(out) :: num_lines