Fade2.5D Documentation pages v2.16.8
Delaunay Features
GEOM_FADE25D::IsoContours Class Reference

The IsoContours class computes intersections of planes with a set of triangles, generating iso-contours (profiles or slices) in 3D space. More...

#include <IsoContours.h>

Public Member Functions

CLASS_DECLSPEC IsoContours (std::vector< Point2 > &vCorners, const Vector2 &dirVec)
 Constructor to initialize IsoContours with a set of triangle corners and slice direction. More...
 
CLASS_DECLSPEC IsoContours (std::vector< Triangle2 * > &vTriangles)
 Constructor. More...
 
CLASS_DECLSPEC ~IsoContours ()
 Destructor.
 
CLASS_DECLSPEC bool getContours (double height, std::vector< std::vector< Segment2 > > &vvContours, bool bVerbose, bool bAutoPerturbate=true)
 Get the contours at a specified height. More...
 
CLASS_DECLSPEC double getMaxHeight ()
 Get the maximum height (largest z-coordinate). More...
 
CLASS_DECLSPEC double getMinHeight ()
 Get the minimum height (smallest z-coordinate). More...
 
CLASS_DECLSPEC void getProfile (const Point2 &p, std::vector< Segment2 > &vSegmentsOut)
 Get the profile at a specified point. More...
 

Protected Member Functions

 IsoContours (const IsoContours &other)
 
IsoContoursoperator= (const IsoContours &other)
 

Protected Attributes

std::vector< Triangle2 * > vTriangles
 

Detailed Description

The class computes iso-contours by slicing with horizontal planes at specific heights, and it enables generating profiles by slicing along arbitrary directions. It uses fast spatial data structures to efficiently generate the corresponding contour lines.

A terrain with ISO contours at multiple heights
Note
This class is not limited to 2.5D but accepts real 3D models as input.
See also
This article contains example code.

Constructor & Destructor Documentation

◆ IsoContours() [1/2]

CLASS_DECLSPEC GEOM_FADE25D::IsoContours::IsoContours ( std::vector< Triangle2 * > &  vTriangles)
explicit

This constructor initializes the IsoContours object with a set of triangles and enables the generation of iso-contours by cutting the Triangle2 objects with horizontal planes along the z-axis.

Parameters
vTrianglesA reference to a vector containing Triangle2 pointers.

◆ IsoContours() [2/2]

CLASS_DECLSPEC GEOM_FADE25D::IsoContours::IsoContours ( std::vector< Point2 > &  vCorners,
const Vector2 dirVec 
)

This constructor initializes the IsoContours object using triangle corners and allows generating iso-contours (slices or profiles) based on the provided direction vector. The direction vector defines the cutting direction, enabling slices to be created in arbitrary directions.

Parameters
vCornersA vector containing 3*n points, specifying n triangles. Each triangle is defined by 3 consecutive points.
dirVecA vector specifying the slice direction for computing the iso-contours (profiles).

Member Function Documentation

◆ getContours()

CLASS_DECLSPEC bool GEOM_FADE25D::IsoContours::getContours ( double  height,
std::vector< std::vector< Segment2 > > &  vvContours,
bool  bVerbose,
bool  bAutoPerturbate = true 
)

This method computes the intersection of a horizontal plane at a specific height with all triangles and returns the resulting contours. The method requires height values that are not equal to the z-coordinate of any triangle vertices. If the provided height value coincides with a vertex, the method returns false except autoPerturbate=true. In this case a tiny offset is automatically added to height.

Parameters
heightThe height (z-coordinate) at which to compute the contours.
vvContoursA reference to a vector of vectors, where each vector contains the segments of a contour (polygon or polyline).
bVerboseA flag to enable verbose output.
bAutoPerturbateA flag to automatically perturb the height slightly if it coincides with a vertex (default is true).
Returns
True if the contours were successfully computed, otherwise false.

◆ getMaxHeight()

CLASS_DECLSPEC double GEOM_FADE25D::IsoContours::getMaxHeight ( )
Returns
The largest z-coordinate of the data

◆ getMinHeight()

CLASS_DECLSPEC double GEOM_FADE25D::IsoContours::getMinHeight ( )
Returns
The smallest z-coordinate of the data

◆ getProfile()

CLASS_DECLSPEC void GEOM_FADE25D::IsoContours::getProfile ( const Point2 p,
std::vector< Segment2 > &  vSegmentsOut 
)

This method computes the slice orthogonal to a direction defined in the constructor.

Parameters
pA point specifying the location of the slice.
vSegmentsOutA reference to a vector that will be filled with the segments of the profile.

The documentation for this class was generated from the following file: