Fade2.5D Documentation pages v2.16.7
Delaunay Features
Tools

Functions

CLASS_DECLSPEC void GEOM_FADE25D::edgesToPolygons (const std::vector< Edge2 > &vEdgesIn, std::vector< std::vector< Edge2 > > &vvPolygonsOut, std::vector< Edge2 > &vRemainingOut)
 Organize a set of edges into polygons. More...
 
CLASS_DECLSPEC bool GEOM_FADE25D::fillHole (const std::vector< Point2 > &vMeshCorners, const std::vector< Segment2 > &vPolygonSegments, bool bWithRefine, bool bVerbose, std::vector< Point2 > &vCornersOut)
 Fill a hole in a 3D mesh with triangles (deprecated) More...
 
CLASS_DECLSPEC bool GEOM_FADE25D::fillHole (const std::vector< std::pair< Segment2, Vector2 > > &vPolygonSegments, bool bWithRefine, bool bVerbose, std::vector< Point2 > &vCornersOut)
 Fill a hole in a 3D mesh with triangles (deprecated) More...
 
CLASS_DECLSPEC bool GEOM_FADE25D::fillHole (Mesh3 *pMesh, const std::vector< Edge2 > &vPolygonEdges, bool bWithRefine, bool bVerbose, std::vector< Point2 > &vCornersOut)
 Fill a hole in a 3D mesh with triangles (deprecated) More...
 
CLASS_DECLSPEC double GEOM_FADE25D::getArea25D (const Point2 *p0, const Point2 *p1, const Point2 *p2)
 Get 2.5D area of a triangle. More...
 
CLASS_DECLSPEC double GEOM_FADE25D::getArea2D (const Point2 *p0, const Point2 *p1, const Point2 *p2)
 Get 2D area of a triangle. More...
 
CLASS_DECLSPEC void GEOM_FADE25D::getBorders (const std::vector< Triangle2 * > &vT, std::vector< Segment2 > &vBorderSegmentsOut)
 Get the border segments of a set of triangles. More...
 
CLASS_DECLSPEC void GEOM_FADE25D::getConnectedComponents (const std::vector< Triangle2 * > &vT, std::vector< std::vector< Triangle2 * > > &vvT)
 Get connected components. More...
 
CLASS_DECLSPEC void GEOM_FADE25D::getDirectedEdges (const std::vector< Triangle2 * > &vT, std::vector< Edge2 > &vDirectedEdgesOut)
 Get directed edges. More...
 
CLASS_DECLSPEC int GEOM_FADE25D::getGlobalNumCPU ()
 Get the number of cpu cores to be used. More...
 
CLASS_DECLSPEC Vector2 GEOM_FADE25D::getNormalVector (const Point2 &p0, const Point2 &p1, const Point2 &p2, bool &bOK)
 Get the normal vector of a triangle. More...
 
CLASS_DECLSPEC Orientation2 GEOM_FADE25D::getOrientation2 (const Point2 *p0, const Point2 *p1, const Point2 *p2)
 Get the orientation of three points. More...
 
CLASS_DECLSPEC Orientation2 GEOM_FADE25D::getOrientation2_mt (const Point2 *p0, const Point2 *p1, const Point2 *p2)
 Get the orientation of three points (MT) More...
 
CLASS_DECLSPEC void GEOM_FADE25D::getSortedBoundaryPolygons (std::vector< Triangle2 * > &vConnectedComponent, std::vector< Edge2 > &vOutsidePolygon, std::vector< std::vector< Edge2 > > &vHolePolygons)
 Get sorted boundary polygons. More...
 
CLASS_DECLSPEC void GEOM_FADE25D::getUndirectedEdges (const std::vector< Triangle2 * > &vT, std::vector< Edge2 > &vUndirectedEdgesOut)
 Get undirected edges. More...
 
CLASS_DECLSPEC bool GEOM_FADE25D::isSimplePolygon (std::vector< Segment2 > &vSegments)
 Check if a polygon is simple. More...
 
CLASS_DECLSPEC void GEOM_FADE25D::offsetPolygonPoints (double offset, const std::vector< Point2 > &vOrgPoints, std::vector< Point2 > &vOffsetPoints, double maxCorrectionFactor=1.0)
 Get offset points (deprecated) More...
 
CLASS_DECLSPEC void GEOM_FADE25D::pointsToPolyline (std::vector< Point2 > &vInPoints, bool bClose, std::vector< Segment2 > &vOutSegments)
 Create segments from a set of points. More...
 
CLASS_DECLSPEC int GEOM_FADE25D::setGlobalNumCPU (int numCPU)
 Set the global number of threads to be used. More...
 
CLASS_DECLSPEC void GEOM_FADE25D::simplifyPolygon (const std::vector< Point2 > &vIn, double errBound, std::vector< Point2 > &vOut)
 Simplify a polygon. More...
 
CLASS_DECLSPEC bool GEOM_FADE25D::sortRing (std::vector< Segment2 > &vRing)
 Sort a vector of segments. More...
 
CLASS_DECLSPEC bool GEOM_FADE25D::sortRingCCW (std::vector< Segment2 > &vRing)
 Order and orient a vector of segments (CCW) More...
 
CLASS_DECLSPEC void GEOM_FADE25D::untwistPolygon (std::vector< Segment2 > &vPolygon, std::vector< std::vector< Segment2 > > &vvPolygon)
 Repair a selfintersecting polygon (deprecated) More...
 

Detailed Description

Function Documentation

◆ edgesToPolygons()

CLASS_DECLSPEC void GEOM_FADE25D::edgesToPolygons ( const std::vector< Edge2 > &  vEdgesIn,
std::vector< std::vector< Edge2 > > &  vvPolygonsOut,
std::vector< Edge2 > &  vRemainingOut 
)

This method processes a set of unorganized edges, grouping them into one or more polygons when possible.

Parameters
[in]vEdgesInA vector of Edge2 objects forming the input set.
[out]vvPolygonsOutA vector of output polygons, where each polygon is represented as a vector<Edge2>.
[out]vRemainingOutA vector containing edges that could not form a closed polygon.

The method adds one vector<Edge2> to vvPolygonsOut for each polygon found in vEdgesIn. Any edges that do not form a closed polygon are stored in vRemainingOut.

Polygons created by edgesToPolygons()
Note
An Edge2 object represents an edge of a Triangle2. The corners of a Triangle2 are always counterclockwise (CCW) oriented. Consequently, polygons that enclose a set of triangles are CCW-oriented while hole polygons are clockwise (CW) oriented. See the figure for an illustration.

◆ fillHole() [1/3]

CLASS_DECLSPEC bool GEOM_FADE25D::fillHole ( const std::vector< Point2 > &  vMeshCorners,
const std::vector< Segment2 > &  vPolygonSegments,
bool  bWithRefine,
bool  bVerbose,
std::vector< Point2 > &  vCornersOut 
)
Deprecated:
This function was experimental and is now deprecated because 3D point cloud meshing has been moved to the WOF library.
Parameters
[in]vMeshCornersspecifies the input mesh, 3 points per triangle in counterclockwise order.
[in]vPolygonSegmentsare the edges of the closed polygon to be triangulated.
[in]bWithRefinespecifies if additional vertices shall be created (bWithRefine=true is experimental, don't use currently)
[in]bVerbosespecifies if warnings shall be printed to stdout
[out]vCornersOutcontains the created fill triangles, 3 corners per triangle, counterclockwise oriented.
Note
This function is deprecated because all related functionality has been moved to the WOF project.

◆ fillHole() [2/3]

CLASS_DECLSPEC bool GEOM_FADE25D::fillHole ( const std::vector< std::pair< Segment2, Vector2 > > &  vPolygonSegments,
bool  bWithRefine,
bool  bVerbose,
std::vector< Point2 > &  vCornersOut 
)
Deprecated:
This function was experimental and is now deprecated because 3D point cloud meshing has been moved to the WOF library.
Parameters
[in]vPolygonSegmentscontains the segments of a closed, simple input polygon along with normal vectors. The segments are counterclockwise oriented and ordered with respect to the surface to be created. Check twice, the orientation is very important. The normal vectors point in the direction of the thought surface at the segment i.e., if a hole is filled, the normal vector of an adjecent triangle is taken but if a T-joint is filled the normal vector should be the average normal of the two triangles at the edge.
[in]bWithRefinespecifies if additional vertices shall be created. (bWithRefine=true is experimental, don't use currently)
[in]bVerbosespecifies if warnings shall be printed to stdout
[out]vCornersOutcontains the created fill triangles, 3 corners per triangle, counterclockwise oriented.
Note
This function is deprecated because all related functionality has been moved to the WOF project.

◆ fillHole() [3/3]

CLASS_DECLSPEC bool GEOM_FADE25D::fillHole ( Mesh3 *  pMesh,
const std::vector< Edge2 > &  vPolygonEdges,
bool  bWithRefine,
bool  bVerbose,
std::vector< Point2 > &  vCornersOut 
)
Deprecated:
This function was experimental and is now deprecated because 3D point cloud meshing has been moved to the WOF library.
Parameters
[in]pMesh
[in]vPolygonEdgesare edges of the polygon to be triangulated. They must form a closed polygon in the mesh.
[in]bWithRefinespecifies if additional vertices shall be created (Note: bWithRefine=true is experimental, don't use currently)
[in]bVerbosespecifies if warnings shall be printed to stdout
[out]vCornersOutcontains the created fill triangles, 3 corners per triangle, counterclockwise oriented.
Note
This function is deprecated because all related functionality has been moved to the WOF project.

◆ getArea25D()

CLASS_DECLSPEC double GEOM_FADE25D::getArea25D ( const Point2 p0,
const Point2 p1,
const Point2 p2 
)

Computes the area of the triangle defined by the three input points p0, p1, and p2.

Parameters
[in]p0,p1,p2The corners of the triangle.
Returns
The 2.5D area of the triangle.

◆ getArea2D()

CLASS_DECLSPEC double GEOM_FADE25D::getArea2D ( const Point2 p0,
const Point2 p1,
const Point2 p2 
)

Computes the 2D area of the triangle defined by the three input points p0, p1, p2.

Note
This function ignores the z-coordinate.
See also
getArea25D()
Parameters
[in]p0,p1,p2The corners of the triangle.
Returns
The 2D area of the triangle.

◆ getBorders()

CLASS_DECLSPEC void GEOM_FADE25D::getBorders ( const std::vector< Triangle2 * > &  vT,
std::vector< Segment2 > &  vBorderSegmentsOut 
)

This function computes the borders of the triangles in vT, which consist of all edges that have exactly one adjacent triangle in vT.

Parameters
[in]vTA vector containing the input triangles
[out]vBorderSegmentsOutA vector that will contain the border segments as Segment2 objects

◆ getConnectedComponents()

CLASS_DECLSPEC void GEOM_FADE25D::getConnectedComponents ( const std::vector< Triangle2 * > &  vT,
std::vector< std::vector< Triangle2 * > > &  vvT 
)

This function partitions the triangles in vT into connected components, which are sets of triangles that are connected by shared edges.

Parameters
[in]vTA vector containing the input triangles
[out]vvTA vector of vectors that will contain the connected components of triangles

◆ getDirectedEdges()

CLASS_DECLSPEC void GEOM_FADE25D::getDirectedEdges ( const std::vector< Triangle2 * > &  vT,
std::vector< Edge2 > &  vDirectedEdgesOut 
)

The directed edges of vT are returned in vDirectedEdgesOut. Directed means that each edge (a,b) with two adjacent triangles in vT is returned twice, as edge(a,b) and edge(b,a).

◆ getGlobalNumCPU()

CLASS_DECLSPEC int GEOM_FADE25D::getGlobalNumCPU ( )
Returns
The global number of cpu cores that can be used by Fade2D.
Note
Fade is by default single-threaded to avoid nested multithreading when Fade runs within multiple threads of your application. However, you can modify the number of threads using setGlobalNumCPU().

◆ getNormalVector()

CLASS_DECLSPEC Vector2 GEOM_FADE25D::getNormalVector ( const Point2 p0,
const Point2 p1,
const Point2 p2,
bool &  bOK 
)

Computes the normalized normal vector of the triangle defined by the three input points p0, p1, and p2.

Parameters
[in]p0,p1,p2The corners of the triangle. If these points are counterclockwise (CCW) oriented, the resulting normal vector points towards the viewer.
[out]bOKA boolean value that returns true for valid results or false if the input points are collinear.
Returns
The normalized normal vector of the triangle.

◆ getOrientation2()

CLASS_DECLSPEC Orientation2 GEOM_FADE25D::getOrientation2 ( const Point2 p0,
const Point2 p1,
const Point2 p2 
)

This function returns the exact orientation of the points p0, p1, p2.

Parameters
[in]p0,p1,p2The three input points.
Returns
The orientation of the points:
  • ORIENTATION2_COLLINEAR if p0, p1, p2 are collinear.
  • ORIENTATION2_CCW if p0, p1, p2 are counterclockwise (CCW) oriented.
  • ORIENTATION2_CW if p0, p1, p2 are clockwise (CW) oriented.
Note
This function is not thread-safe but is faster than the thread-safe version.
See also
getOrientation2_mt() The thread-safe version of this function.

◆ getOrientation2_mt()

CLASS_DECLSPEC Orientation2 GEOM_FADE25D::getOrientation2_mt ( const Point2 p0,
const Point2 p1,
const Point2 p2 
)

This function returns the exact orientation of the points p0, p1, p2.

Parameters
[in]p0,p1,p2The three input points.
Returns
The orientation of the points:
  • ORIENTATION2_COLLINEAR if p0, p1, p2 are collinear.
  • ORIENTATION2_CCW if p0, p1, p2 are counterclockwise (CCW) oriented.
  • ORIENTATION2_CW if p0, p1, p2 are clockwise (CW) oriented.
Note
This function is thread-safe.

◆ getSortedBoundaryPolygons()

CLASS_DECLSPEC void GEOM_FADE25D::getSortedBoundaryPolygons ( std::vector< Triangle2 * > &  vConnectedComponent,
std::vector< Edge2 > &  vOutsidePolygon,
std::vector< std::vector< Edge2 > > &  vHolePolygons 
)

This function processes a single edge-connected component of triangles and returns the outer polygon, as well as any inner hole polygons, if present.

Parameters
[in]vConnectedComponentA connected component of triangles, where the term "connected" means adjacency on edges. It is important that only one connected component is passed!
[out]vOutsidePolygonThe outside boundary of the connected component.
[out]vHolePolygonsA vector that will contain any hole polygons, if they exist.
Note
The edges in the output polygons are sorted and oriented counterclockwise (CCW) with respect to their triangle. Thus, the outer polygon is always CCW-oriented, and hole polygons are always clockwise (CW)-oriented. This property is sometimes useful.
Attention
Ensure that only one connected component is passed to this function.

◆ getUndirectedEdges()

CLASS_DECLSPEC void GEOM_FADE25D::getUndirectedEdges ( const std::vector< Triangle2 * > &  vT,
std::vector< Edge2 > &  vUndirectedEdgesOut 
)

This function computes the edges of the input triangles. The term "undirected" means that edges which appear twice with different orientations (i.e., reversed directions) are only returned once, with an arbitrary orientation.

Parameters
[in]vTA vector containing the input triangles.
[out]vUndirectedEdgesOutA vector that will contain the output edges.

◆ isSimplePolygon()

CLASS_DECLSPEC bool GEOM_FADE25D::isSimplePolygon ( std::vector< Segment2 > &  vSegments)

This function checks whether the given set of segments forms a simple polygon. A polygon is considered simple if it is closed (the first and last vertices are connected) and does not have any self-intersections. Degenerate segments (i.e., segments with zero length) are ignored during the check.

Parameters
[in]vSegmentsA vector of Segment2 objects forming the input.
Returns
true if vSegments forms a closed polygon without self-intersections; false otherwise.

◆ offsetPolygonPoints()

CLASS_DECLSPEC void GEOM_FADE25D::offsetPolygonPoints ( double  offset,
const std::vector< Point2 > &  vOrgPoints,
std::vector< Point2 > &  vOffsetPoints,
double  maxCorrectionFactor = 1.0 
)
Deprecated:
This function is deprecated in favor of Zone2::getOffsetBoundary() which will also resolve self-intersections. Do not use this function anymore!
Parameters
offsetspecifies the offset distance (positive or negative)
[in]vOrgPointsare ordered points of a counterclockwise polygon (no point repeated)
[out]vOffsetPointsreturns points moved outside/inside by a positive/negative offset distance (times the angle correction factor)
[in]maxCorrectionFactoris the maximum angle correction factor that may be applied to the offset value. It's default value is 1.0 (no angle correction), lower values are ignored. The angle that can be corrected with a certain maxCorrectionFactor is computed according to $ 2*asin(1.0/maxCorrectionFactor) $. This means, a maxCorrectionFactor=1.4143 can account for angles down to 90 degrees while 2.6132 is required to correct angles as low as 45 degrees.
Note
You may want to simplify and smooth the input polygon using simplifyPolygon() before using this function.
Warning
The resuling offset polygon may self-intersect!

◆ pointsToPolyline()

CLASS_DECLSPEC void GEOM_FADE25D::pointsToPolyline ( std::vector< Point2 > &  vInPoints,
bool  bClose,
std::vector< Segment2 > &  vOutSegments 
)

Turns a vector of points (p0, p1, p2, ..., pm, pn) into a vector of segments ((p0, p1), (p1, p2), ..., (pm, pn)). In case that bClose is true and pn!=p0, an additional segment (pn, p0) is constructed. Degenerate segments are ignored. Self-intersections of the polyline are not checked.

Parameters
[in]vInPointsThe input vector of points.
[in]bCloseSpecifies whether a closing segment shall be constructed.
[out]vOutSegmentsThe output vector where the segments are stored.

◆ setGlobalNumCPU()

CLASS_DECLSPEC int GEOM_FADE25D::setGlobalNumCPU ( int  numCPU)

Sets the number of CPU cores that Fade should use for parallel operations.

Parameters
numCPUThe number of CPU cores to be used. A value of 0 means autodetection.
Returns
The number of CPU cores that will be used.
Note
Fade is by default single-threaded to avoid nested multithreading when Fade runs in multiple threads of your application.

Characteristics:

  • When triangulating both a point cloud and constraint segments, you should insert the points first. This allows the algorithm to fully leverage multithreading.
  • Fade continues to support older platforms, but multithreading requires C++11 and is not available for very old compilers.

◆ simplifyPolygon()

CLASS_DECLSPEC void GEOM_FADE25D::simplifyPolygon ( const std::vector< Point2 > &  vIn,
double  errBound,
std::vector< Point2 > &  vOut 
)

This function simplifies the input polygon based on the specified geometric error. Does not automatically check for self-intersections.

Parameters
[in]vInspecifies the input polygon to be simplified.
[in]errBoundbounds the maximum geometric error.
[out]vOutthe simplified output polygon.

◆ sortRing()

CLASS_DECLSPEC bool GEOM_FADE25D::sortRing ( std::vector< Segment2 > &  vRing)

This function reorients and sorts the segments in vRing such that each segment joins at the endpoint of the previous one.

Parameters
[in,out]vRingA vector of segments to be sorted and reoriented.
Returns
Returns true if the sorting was successful; otherwise, false.

◆ sortRingCCW()

CLASS_DECLSPEC bool GEOM_FADE25D::sortRingCCW ( std::vector< Segment2 > &  vRing)

This function reorients and sorts the segments in vRing such that the resulting polygon is counterclockwise oriented. It ensures that subsequent segments join at their endpoints to form a continuous polygon.

Parameters
[in,out]vRingA vector of segments that will be sorted and reoriented to form a CCW polygon.
Returns
Returns true if the sorting was successful; otherwise, false.

◆ untwistPolygon()

CLASS_DECLSPEC void GEOM_FADE25D::untwistPolygon ( std::vector< Segment2 > &  vPolygon,
std::vector< std::vector< Segment2 > > &  vvPolygon 
)
Deprecated:
This function is deprecated but retained for backward compatibility. It is recommended to use the PolygonClipper class instead, which offers greater versatility and robustness.
Parameters
vPolygon[in] The input polygon, no specific order and orientation
vvPolygon[out] One or more output polygons, free of selfintersections, counterclockwise oriented around the enclosed area