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>
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.
◆ 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
-
vTriangles | A 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
-
vCorners | A vector containing 3*n points, specifying n triangles. Each triangle is defined by 3 consecutive points. |
dirVec | A vector specifying the slice direction for computing the iso-contours (profiles). |
◆ 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
-
height | The height (z-coordinate) at which to compute the contours. |
vvContours | A reference to a vector of vectors, where each vector contains the segments of a contour (polygon or polyline). |
bVerbose | A flag to enable verbose output. |
bAutoPerturbate | A 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
-
p | A point specifying the location of the slice. |
vSegmentsOut | A 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: