fortplot_contour_regions Module

Contour polygon decomposition for extracting filled regions

This module provides functions for decomposing 2D contour data into polygonal regions between contour levels, supporting filled contour visualization across PNG, PDF, and ASCII backends.

= Key Types = - contour_region_t: Represents a single contour region with boundary - contour_polygon_t: Polygon boundary with points

= Core Functions = - extract_contour_regions: Main polygon decomposition function - get_region_boundaries: Extract boundary points for regions

Author: fortplot contributors



Derived Types

type, public ::  contour_polygon_t

Polygon boundary with ordered vertex points

Components

Type Visibility Attributes Name Initial
real(kind=wp), public, allocatable :: x(:)
real(kind=wp), public, allocatable :: y(:)
logical, public :: is_closed = .false.

type, public ::  contour_region_t

Region between contour levels with boundary polygons

Components

Type Visibility Attributes Name Initial
real(kind=wp), public :: level_min = 0.0_wp
real(kind=wp), public :: level_max = 0.0_wp
type(contour_polygon_t), public, allocatable :: boundaries(:)
integer, public :: region_id = 0

Functions

public function extract_contour_regions(x_grid, y_grid, z_grid, levels) result(regions)

Extract polygonal regions between contour levels using marching squares

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: x_grid(:)
real(kind=wp), intent(in) :: y_grid(:)
real(kind=wp), intent(in) :: z_grid(:,:)
real(kind=wp), intent(in) :: levels(:)

Return Value type(contour_region_t), allocatable, (:)