Fade2D Documentation pages v2.01
Delaunay Features
freeFunctions.h File Reference
#include "Point2.h"
#include "Segment2.h"
#include "Edge2.h"
#include <vector>

Go to the source code of this file.


void GEOM_FADE2D::edgesToPolygons (std::vector< Edge2 > &vEdgesIn, std::vector< std::vector< Edge2 > > &vvPolygonsOut, std::vector< Edge2 > &vRemainingOut)
 Create polygons from a set of edges. More...
bool GEOM_FADE2D::fillHole (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...
double GEOM_FADE2D::getArea2D (Point2 *p0, Point2 *p1, Point2 *p2)
 Get 2D area of a triangle. More...
void GEOM_FADE2D::getBorders (const std::vector< Triangle2 * > &vT, std::vector< Segment2 > &vBorderSegmentsOut)
 Get Borders. More...
void GEOM_FADE2D::getConnectedComponents (const std::vector< Triangle2 * > &vT, std::vector< std::vector< Triangle2 * > > &vvT)
 Get connected components. More...
void GEOM_FADE2D::getDirectedEdges (const std::vector< Triangle2 * > &vT, std::vector< Edge2 > &vDirectedEdgesOut)
 Get directed edges 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).
const char * GEOM_FADE2D::getFade2DVersion ()
 Get the Fade2D version string.
int GEOM_FADE2D::getMajorVersionNumber ()
 Get the major version number.
int GEOM_FADE2D::getMinorVersionNumber ()
 Get the minor version number.
Orientation2 GEOM_FADE2D::getOrientation2 (const Point2 *p0, const Point2 *p1, const Point2 *p2)
 Get the orientation of three points. More...
Orientation2 GEOM_FADE2D::getOrientation2_mt (const Point2 *p0, const Point2 *p1, const Point2 *p2)
 Get Orientation2 (MT) More...
int GEOM_FADE2D::getRevisionNumber ()
 Get the revision version number.
void GEOM_FADE2D::getSortedBoundaryPolygons (std::vector< Triangle2 * > &vConnectedComponent, std::vector< Edge2 > &vOutsidePolygon, std::vector< std::vector< Edge2 > > &vHolePolygons)
 Get sorted boundary polygons. More...
void GEOM_FADE2D::getUndirectedEdges (const std::vector< Triangle2 * > &vT, std::vector< Edge2 > &vUndirectedEdgesOut)
 Get undirected edges. More...
bool GEOM_FADE2D::isRelease ()
 Check if a RELEASE or a DEBUG version is used.
bool GEOM_FADE2D::isSimplePolygon (std::vector< Segment2 > &vSegments)
 isSimplePolygon More...
void GEOM_FADE2D::offsetPolygonPoints (double offset, std::vector< Point2 > &vOrgPoints, std::vector< Point2 > &vOffsetPoints, double maxCorrectionFactor=1.0)
 Create an offet polygon. More...
void GEOM_FADE2D::pointsToPolyline (std::vector< Point2 > &vInPoints, bool bClose, std::vector< Segment2 > &vOutSegments)
 Points-to-Polyline. More...
bool GEOM_FADE2D::readPointsBIN (const char *filename, std::vector< Point2 > &vPointsIn)
 Read points from a binary file. More...
bool GEOM_FADE2D::readSegmentsBIN (const char *filename, std::vector< Segment2 > &vSegmentsOut)
 Read segments from a binary file. More...
bool GEOM_FADE2D::readXY (const char *filename, std::vector< Point2 > &vPointsOut)
 Read (x y) points. More...
bool GEOM_FADE2D::sortRing (std::vector< Segment2 > &vRing)
 Sort a vector of Segments. More...
bool GEOM_FADE2D::sortRingCCW (std::vector< Segment2 > &vRing)
 Sort a vector of Segments. More...
bool GEOM_FADE2D::writePointsASCII (const char *filename, const std::vector< Point2 * > &vPointsIn)
 Write points to an ASCII file. More...
bool GEOM_FADE2D::writePointsASCII (const char *filename, const std::vector< Point2 > &vPointsIn)
 Write points to an ASCII file. More...
bool GEOM_FADE2D::writePointsBIN (const char *filename, std::vector< Point2 * > &vPointsIn)
 Write points to a binary file. More...
bool GEOM_FADE2D::writePointsBIN (const char *filename, std::vector< Point2 > &vPointsIn)
 Write points to a binary file. More...
bool GEOM_FADE2D::writeSegmentsBIN (const char *filename, std::vector< Segment2 > &vSegmentsIn)
 Write segments to a binary file. More...

Function Documentation

◆ getSortedBoundaryPolygons()

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

This function takes ONE connected component of triangles. It returns the outer polygon as well as the inner hole polygons if any.

[in]vConnectedComponentis a connected component of triangles where the term "connected" means adjacency on edges. It is important that just one connected component is passed!
[out]vOutsidePolygonis the outside boundary of the connected component.
[out]vHolePolygonscontains the hole polygons (if any)

Edges in output polygons are sorted and CCW-oriented with respect to their triangle. Thus the outer polygon is always CCW oriented and holes are always CW oriented. This is sometimes a useful property.

Pass only one connected component.

◆ offsetPolygonPoints()

void GEOM_FADE2D::offsetPolygonPoints ( double  offset,
std::vector< Point2 > &  vOrgPoints,
std::vector< Point2 > &  vOffsetPoints,
double  maxCorrectionFactor = 1.0 
Offset polygon without angle correction
Offset polygon with maximum angle correction factor 1.414 (down to 90 degrees)
Offset polygon with angle correction limited to factor 6.25 (for angles as low as 18.4 degrees)
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.
An offset polygon can selfintersect!