Fade_2D is the Delaunay triangulation class. More...
#include <Fade_2D.h>
Public Member Functions | |
Fade_2D (Fade_2D &other, std::vector< Zone2 * > vZoneIn=std::vector< Zone2 * >(), std::vector< Zone2 * > vZoneOut=std::vector< Zone2 * >()) | |
Copy constructor, copy also zones. | |
Fade_2D (unsigned numExpectedVertices=3) | |
Constructor of the triangulation class. More... | |
~Fade_2D () | |
Destructor. | |
void | applyConstraintsAndZones () |
Apply conforming constraints and zones (deprecated!) More... | |
bool | checkValidity (bool bCheckEmptyCircleProperty, const char *msg) const |
Checks if a triangulation is valid. More... | |
Bbox2 | computeBoundingBox () const |
Compute the axis-aligned bounding box of the points. More... | |
ConstraintGraph2 * | createConstraint (std::vector< Segment2 > &vSegments, ConstraintInsertionStrategy cis, bool bOrientedSegments=false, bool bUseHeightOfLatest=false) |
Add constraint edges (edges, polyline, polygon) . More... | |
Zone2 * | createZone (const std::vector< ConstraintGraph2 * > &vConstraintGraphs, ZoneLocation zoneLoc, const Point2 &startPoint, bool bVerbose=true) |
Create a zone limited by multiple ConstraintGraph2 objects by growing from a start point. More... | |
Zone2 * | createZone (ConstraintGraph2 *pConstraintGraph, ZoneLocation zoneLoc, bool bVerbose=true) |
Create a zone. More... | |
Zone2 * | createZone (ConstraintGraph2 *pConstraintGraph, ZoneLocation zoneLoc, const Point2 &startPoint, bool bVerbose=true) |
Create a zone limited by a ConstraintGraph by growing from a start point. More... | |
Zone2 * | createZone (std::vector< Triangle2 * > &vTriangles, bool bVerbose=true) |
Create a zone defined by a vector of triangles. More... | |
Zone2 * | createZone_cookieCutter (std::vector< Segment2 > &vSegments, bool bProtectEdges, ConstraintGraph2 *&pProtectedEdgesCG, ConstraintGraph2 *&pBoundaryCG) |
Cookie Cutter The Cookie Cutter cuts out a part of a triangulation and returns it as a Zone2 object. More... | |
void | cutTriangles (const Point2 &knifeStart, const Point2 &knifeEnd, bool bTurnEdgesIntoConstraints) |
Cut through a triangulation. More... | |
void | cutTriangles (std::vector< Segment2 > &vSegments, bool bTurnEdgesIntoConstraints) |
Cut through a triangulation. More... | |
void | deleteZone (Zone2 *pZone) |
Delete a Zone2 object. More... | |
bool | drape (std::vector< Segment2 > &vSegmentsIn, std::vector< Segment2 > &vSegmentsOut, double zTolerance, double offTolerance=0.0) const |
Drape segments along a surface. More... | |
void | exportTriangulation (FadeExport &fadeExport, bool bWithCustomIndices, bool bClear) |
Export triangulation data from Fade. More... | |
Triangle2 * | getAdjacentTriangle (Point2 *p0, Point2 *p1) const |
Get adjacent triangle. More... | |
void | getAliveAndDeadConstraintSegments (std::vector< ConstraintSegment2 * > &vAllConstraintSegments) const |
Get all (alive and dead) constraint segments. | |
void | getAliveConstraintSegments (std::vector< ConstraintSegment2 * > &vAliveConstraintSegments) const |
Get active (alive) constraint segments. | |
ConstraintSegment2 * | getConstraintSegment (Point2 *p0, Point2 *p1) const |
Retrieve a ConstraintSegment2. More... | |
void | getConvexHull (bool bAllVertices, std::vector< Point2 * > &vConvexHullPointsOut) |
Compute the convex hull. More... | |
void | getDirectedEdges (std::vector< Edge2 > &vDirectedEdgesOut) const |
Get directed edges Edges are counterclockwise oriented around their triangle. The present method returns directed edges. That means each edge(a,b) is returend twice, as edge(a,b) and as edge(b,a). | |
bool | getHeight (double x, double y, double &heightOut, Triangle2 *pApproxT=NULL, double tolerance=0) const |
Compute the height of a certain point. More... | |
void | getIncidentTriangles (Point2 *pVtx, std::vector< Triangle2 * > &vIncidentT) const |
Get incident triangles. More... | |
void | getIncidentVertices (Point2 *pVtx, std::vector< Point2 * > &vIncidentVertices) const |
Get incident vertices. More... | |
Point2 * | getNearestNeighbor (const Point2 &p) |
Get nearest neighbor. More... | |
Orientation2 | getOrientation (const Point2 &p0, const Point2 &p1, const Point2 &p2) |
Compute the orientation of 3 points. More... | |
Zone2 * | getPeeledZone (double angleThreshold, bool bAvoidSplit) |
Get a peeled zone The getPeeledZone() function returns a zone that includes all triangles of dt except for the almost vertical ones typically found at the boundary of a 2.5D triangulation. More precisely, this function iteratively identifies and removes boundary triangles whose normal vector encloses a larger angle with the vector (0,0,1) than angleThreshold degrees. If no triangles remain, the method returns NULL. More... | |
void | getTrianglePointers (std::vector< Triangle2 * > &vAllTriangles) const |
Get pointers to all triangles. More... | |
void | getUndirectedEdges (std::vector< Edge2 > &vUndirectedEdgesOut) const |
Get undirected edges. More... | |
void | getVertexPointers (std::vector< Point2 * > &vAllPoints) const |
Get pointers to all vertices. More... | |
Voronoi2 * | getVoronoiDiagram () |
Get the Voronoi diagram. More... | |
bool | hasArea () const |
Check if the triangulation contains triangles (which is the case if at least 3 non-collinear points exist in the triangulation. More... | |
Zone2 * | importTriangles (std::vector< Point2 > &vPoints, bool bReorientIfNeeded, bool bCreateExtendedBoundingBox) |
Import triangles. More... | |
void | insert (CloudPrepare *pCloudPrepare, bool bClear=true) |
Insert points from a CloudPrepare object. More... | |
Point2 * | insert (const Point2 &p) |
Insert a single point. More... | |
void | insert (const std::vector< Point2 > &vInputPoints) |
Insert a vector of points. More... | |
void | insert (const std::vector< Point2 > &vInputPoints, std::vector< Point2 * > &vHandles) |
Insert points from a std::vector and store pointers in vHandles. More... | |
void | insert (int numPoints, double *aCoordinates, Point2 **aHandles) |
Insert points from an array. More... | |
bool | isConstraint (Point2 *p0, Point2 *p1) const |
Check if an edge is a constraint edge. More... | |
bool | isConstraint (Point2 *pVtx) const |
Check if a vertex is a constraint vertex. More... | |
bool | isConstraint (Triangle2 *pT, int ith) const |
Check if an edge is a constraint edge. More... | |
bool | load (const char *filename, std::vector< Zone2 * > &vZones) |
Load a triangulation. More... | |
bool | load (std::istream &stream, std::vector< Zone2 * > &vZones) |
Load a triangulation. More... | |
Triangle2 * | locate (const Point2 &p) |
Locate a triangle which contains p. More... | |
double | measureTriangulationTime (const std::vector< Point2 > &vPoints) |
Measure the Delaunay triangulation time. More... | |
size_t | numberOfPoints () const |
Number of points. More... | |
size_t | numberOfTriangles () const |
Number of triangles. More... | |
void | printLicense () const |
Prints license information. | |
void | refine (Zone2 *pZone, double minAngleDegree, double minEdgeLength, double maxEdgeLength, bool bAllowConstraintSplitting) |
Delaunay refinement. More... | |
void | refineAdvanced (MeshGenParams *pParameters) |
Delaunay refinement and grid meshing. More... | |
void | remove (Point2 *pVertex) |
Remove a single vertex. More... | |
void | remove (std::vector< Point2 * > &vPoints) |
Remove vertices. More... | |
void | reset () |
Reset. More... | |
bool | saveTriangulation (const char *filename, std::vector< Zone2 * > &vSaveZones) |
Save a triangulation. More... | |
bool | saveTriangulation (std::ostream &stream, std::vector< Zone2 * > &vSaveZones) |
Save a triangulation. More... | |
bool | saveZones (const char *filename, std::vector< Zone2 * > &vSaveZones) |
Save zones. More... | |
bool | saveZones (std::ostream &stream, std::vector< Zone2 * > &vSaveZones) |
Save zones. More... | |
void | setFastMode (bool bFast) |
Set fast mode. More... | |
int | setNumCPU (int numCPU) |
Set the number CPU cores for multithreading (deprecated) More... | |
void | show (const char *postscriptFilename, bool bWithConstraints=true) const |
Draws the triangulation as postscript file. More... | |
void | show (Visualizer2 *pVis, bool bWithConstraints=true) const |
Draws the triangulation as postscript file using an existing Visualizer2 object. More... | |
void | showGeomview (const char *filename, const char *color="1 1 1 0.5") const |
Draws the triangulation in 3D. More... | |
void | showGeomview (Visualizer3 *pVis, const char *color="1 1 1 0.5") const |
Draws the triangulation in 3D. More... | |
void | statistics (const char *s) const |
Statistics. More... | |
void | subscribe (MsgType msgType, MsgBase *pMsg) |
Register a message receiver. More... | |
void | unsubscribe (MsgType msgType, MsgBase *pMsg) |
Unregister a message receiver. More... | |
void | writeObj (const char *filename) const |
Write the current triangulation to an *.obj file. More... | |
void | writeObj (const char *filename, Zone2 *pZone) const |
Write a zone to an *.obj file. More... | |
void | writeWebScene (const char *path) const |
Write the current triangulation to an *.obj file. More... | |
void | writeWebScene (const char *path, Zone2 *pZone) const |
Write a zone to an *.obj file. More... | |
Fade_2D represents a Delaunay triangulation in 2D or 2.5D (depends on the used namespace)
|
explicit |
numExpectedVertices | specifies the number of points that will be inserted. This is a default parameter that does not need to be specified. |
void GEOM_FADE25D::Fade_2D::applyConstraintsAndZones | ( | ) |
This method establishes conforming constraint segments and zones which depend on them. For technical reasons conforming constraint segments are not immediately established but inserted at the end of the triangulation process. This step must be triggered manually i.e., it is up to the user to call applyConstraintsAndZones() before the resulting triangulation is used. If afterwards the triangulation is changed in any way, applyConstraintsAndZones() must be called again.
bool GEOM_FADE25D::Fade_2D::checkValidity | ( | bool | bCheckEmptyCircleProperty, |
const char * | msg | ||
) | const |
Checks the validity of the data structure.
bCheckEmptyCircleProperty | specifies if (slow!) multiprecision arithmetic shall be used to recheck the empty circle property |
msg | is a debug string that will be shown in terminal output so that you know which checkValidity call currently runs. |
This method is thought for development purposes. Don't call it method unless you assume that something is wrong with the code.
Bbox2 GEOM_FADE25D::Fade_2D::computeBoundingBox | ( | ) | const |
If no points have been inserted yet, then the returned Bbox2 object is invalid and its member function Bbox2::isValid() returns false.
ConstraintGraph2* GEOM_FADE25D::Fade_2D::createConstraint | ( | std::vector< Segment2 > & | vSegments, |
ConstraintInsertionStrategy | cis, | ||
bool | bOrientedSegments = false , |
||
bool | bUseHeightOfLatest = false |
||
) |
vSegments | are segments which shall appear as edges of the triangulation. The segments may be automatically reordered and reoriented, see bOrientedSegments below. |
cis | is the Constraint-Insertion-Strategy. Use always CIS_CONSTRAINED_DELAUNAY. This mode inserts the constraint segments at their original level (no projection onto the surface) and without subdivision unless existing vertices or existing constraint segments are crossed. When subdivision (e.g., to achieve better triangle shapes) is desired then use ConstraintGraph2::makeDelaunay() after insertion. When the segments shall be adapted to the elevation of the existing surface then use Fade_2D::drape(). See the example code in examples_25D/terrain.cpp |
bOrientedSegments | specifies whether the segments in vSegments are oriented (oriented, not ordered!). If later a zone is to be made with the returned ConstraintGraph2 object this is only possible if the value is true (then it is assumed that all segments are counterclockwise oriented) or if the ConstraintGraph2 represents exactly one closed polygon. The value affects also the order of the returned vertices when later ConstraintGraph2::getPolygonVertices() is called. This is a default parameter and it defaults to false. |
bUseHeightOfLatest | specifies that the height z of the last inserted segment is to be used. This is used in conflict case only, e.g. if the endpoint of an inserted segment already exists with a different height, or if an existing constraint segment is cut. By default, the height of the existing elements is used for the intersection point. |
Zone2* GEOM_FADE25D::Fade_2D::createZone | ( | const std::vector< ConstraintGraph2 * > & | vConstraintGraphs, |
ZoneLocation | zoneLoc, | ||
const Point2 & | startPoint, | ||
bool | bVerbose = true |
||
) |
A Zone2 object is an area of the traingulation, see createZone
vConstraintGraphs | is a vector of ConstraintGraph objects |
zoneLoc | must be ZL_GROW |
startPoint | is the point from which the area is grown until the borders specified in vConstraintGraphs are reached |
bVerbose | is by default true and causes a warning if NULL is returned. |
Zone2* GEOM_FADE25D::Fade_2D::createZone | ( | ConstraintGraph2 * | pConstraintGraph, |
ZoneLocation | zoneLoc, | ||
bool | bVerbose = true |
||
) |
A Zone2 object is an area of a triangulation, possibly bounded by a ConstraintGraph.
zoneLoc | is ZL_INSIDE, ZL_OUTSIDE or ZL_GLOBAL. |
pConstraintGraph | points to a formerly created ConstraintGraph2 object (which must be oriented and contain a simple polygon) or is NULL in case of zoneLoc==ZL_GLOBAL. |
bVerbose | is by default true and causes a warning if NULL is returned. |
Zone2* GEOM_FADE25D::Fade_2D::createZone | ( | ConstraintGraph2 * | pConstraintGraph, |
ZoneLocation | zoneLoc, | ||
const Point2 & | startPoint, | ||
bool | bVerbose = true |
||
) |
A Zone2 object is an area of the traingulation, see createZone
pConstraintGraph | is a constraint whose edges specify the area's border |
zoneLoc | must be ZL_GROW |
startPoint | is the point from which the area is grown until the borders specified in pConstraint are reached |
bVerbose | is by default true and causes a warning if NULL is returned. |
Zone2* GEOM_FADE25D::Fade_2D::createZone | ( | std::vector< Triangle2 * > & | vTriangles, |
bool | bVerbose = true |
||
) |
A Zone2 object is an area of the traingulation, see createZone
vTriangles | |
bVerbose | is by default true and causes a warning if NULL is returned. |
Zone2* GEOM_FADE25D::Fade_2D::createZone_cookieCutter | ( | std::vector< Segment2 > & | vSegments, |
bool | bProtectEdges, | ||
ConstraintGraph2 *& | pProtectedEdgesCG, | ||
ConstraintGraph2 *& | pBoundaryCG | ||
) |
[in] | vSegments | specifies the input polygon |
[in] | bProtectEdges | specifies if existing edges shall be locked by turning them into constraint segments |
[out] | pProtectedEdgesCG | is used to return the ConstraintGraph2* of edges that have been protected |
[out] | pBoundaryCG | is used to return the ConstraintGraph2* of the boundary |
Properties: The input polygon (vSegments
) is not required to have specific height values; the z-coordinates are calculated automatically. The input polygon must be simple, meaning it must not intersect itself, and each vertex must belong to exactly two segments. Alternatively, the polygon may self-intersect at vertices, but in that case, all segments must be oriented counterclockwise. The input polygon is automatically trimmed when it lies outside the convex hull of the triangulation. Inserting intersection points would normally cause existing edges in the triangulation to flip, but this can be avoided by setting bProtectEdges=true. In this case, certain edges of the triangulation will become constraint edges.
void GEOM_FADE25D::Fade_2D::cutTriangles | ( | const Point2 & | knifeStart, |
const Point2 & | knifeEnd, | ||
bool | bTurnEdgesIntoConstraints | ||
) |
knifeStart | is one point of the knife segment |
knifeEnd | is the second point of the knife segment |
bTurnEdgesIntoConstraints | turns all 3 edges of each intersected triangle into constraint segments. |
This method inserts a constraint edge knife(knifeStart,knifeEnd). If existing edges E are intersected by knife, then knife is subdivided at the intersection points P.
In any case knife will exist (in a possibly subdivided form) in the result. But a consequence of the insertion of the points P is that the edges E and even edges which are not intersected by knife may be flipped. Use bTurnEdgesIntoConstraints=true to avoid that.
void GEOM_FADE25D::Fade_2D::cutTriangles | ( | std::vector< Segment2 > & | vSegments, |
bool | bTurnEdgesIntoConstraints | ||
) |
vSegments | are the knife segments |
bTurnEdgesIntoConstraints | specifies if intersected edges shall automatically be turned into constraints |
Same method as void cutTriangles(const Point2& knifeStart,const Point2& knifeEnd,bool bTurnEdgesIntoConstraints) but it takes a vector of segments instead of a single segment. This is the recommended method to cut through a triangulation when more than one knife segment exists.
void GEOM_FADE25D::Fade_2D::deleteZone | ( | Zone2 * | pZone | ) |
Zone2 objects are automatically destroyed with their Fade_2D objects. In addition this method provides the possibility to eliminate Zone2 objects earlier.
bool GEOM_FADE25D::Fade_2D::drape | ( | std::vector< Segment2 > & | vSegmentsIn, |
std::vector< Segment2 > & | vSegmentsOut, | ||
double | zTolerance, | ||
double | offTolerance = 0.0 |
||
) | const |
Projects the segments from vSegmentsIn
onto the triangulation. Thereby the segments are subdivided where they intersect edges of the triangulation. Segment parts outside the triangulation are cut off and ignored. Degenerate input segments are also ignored.
The heights (z-values) of the result segments are adapted to the surface.
[in] | zTolerance | is used to avoid excessive subdivision of segments. Use some positive value to define the acceptable geometric error or use zTolerance=-1.0 to split the segments at all intersections with triangulation-edges. |
[in] | vSegmentsIn | Input segments |
[out] | vSegmentsOut | Output segments |
[in] | offTolerance | is used to prevent truncation of segments that are slightly outside the convex hull which might be the case if your input segments are subject to tiny rounding errors. |
void GEOM_FADE25D::Fade_2D::exportTriangulation | ( | FadeExport & | fadeExport, |
bool | bWithCustomIndices, | ||
bool | bClear | ||
) |
fadeExport | is a struct that will hold the requested triangulation data |
bWithCustomIndices | determines whether the custom indices of the points are also stored |
bClear | determines whether the Fade instance is cleared during the export operation to save memory |
ConstraintSegment2* GEOM_FADE25D::Fade_2D::getConstraintSegment | ( | Point2 * | p0, |
Point2 * | p1 | ||
) | const |
void GEOM_FADE25D::Fade_2D::getConvexHull | ( | bool | bAllVertices, |
std::vector< Point2 * > & | vConvexHullPointsOut | ||
) |
bAllVertices | determines if all convex hull points are returned or if collinear ones shall be removed. | |
[out] | vConvexHullPointsOut | is used to return the convex hull vertices in counterclockwise order. The start vertex is the leftmost vertex. If more than one leftmost vertex exists, the bottommost of them is the start vertex. |
bool GEOM_FADE25D::Fade_2D::getHeight | ( | double | x, |
double | y, | ||
double & | heightOut, | ||
Triangle2 * | pApproxT = NULL , |
||
double | tolerance = 0 |
||
) | const |
Computes the height (z) at the coordinates x
and y
, assigns it to heightOut and returns true if successful.
[in] | x,y | are the input coordinates |
[out] | heightOut | is the computed height |
[in] | pApproxT | can be set to a nearby triangle. If unknown, use NULL. |
[in] | tolerance | is by default 0, see below |
tolerance
parameter (default: 0): If your query point is not farther outside the convex hull than tolerance
then the height of the closest point of the convex hull is returned. void GEOM_FADE25D::Fade_2D::getIncidentTriangles | ( | Point2 * | pVtx, |
std::vector< Triangle2 * > & | vIncidentT | ||
) | const |
Stores pointers to all triangles around pVtx into vIncidentT
void GEOM_FADE25D::Fade_2D::getIncidentVertices | ( | Point2 * | pVtx, |
std::vector< Point2 * > & | vIncidentVertices | ||
) | const |
Stores pointers to all vertices around pVtx into vIncidentVertices
This method returns the closest vertex of p
.
[in] | p | is the query point |
Orientation2 GEOM_FADE25D::Fade_2D::getOrientation | ( | const Point2 & | p0, |
const Point2 & | p1, | ||
const Point2 & | p2 | ||
) |
Zone2* GEOM_FADE25D::Fade_2D::getPeeledZone | ( | double | angleThreshold, |
bool | bAvoidSplit | ||
) |
[in] | angleThreshold | is the maximum angle between the normal vector of any kept triangle and the vector (0,0,1). Use for example 89.9 degrees. |
[in] | bAvoidSplit | prevents the zone from breaking apart i.e., if bAvoidSplit=true and removing a triangle would split the zone in two independent connected components then the triangle is not removed. |
void GEOM_FADE25D::Fade_2D::getTrianglePointers | ( | std::vector< Triangle2 * > & | vAllTriangles | ) | const |
This command fetches the existing triangles
[out] | vAllTriangles | is used to return the triangles |
void GEOM_FADE25D::Fade_2D::getUndirectedEdges | ( | std::vector< Edge2 > & | vUndirectedEdgesOut | ) | const |
vUndirectedEdgesOut | is used to return a unique set of undirected edges. |
void GEOM_FADE25D::Fade_2D::getVertexPointers | ( | std::vector< Point2 * > & | vAllPoints | ) | const |
vAllPoints | is an empty vector of Point2 pointers. |
Stores pointers to all vertices of the triangulation in vAllPoints. The order in which the points are stored is not necessarily the insertion order. For geometrically identical points which have been inserted multiple times, only one pointer exists. Thus vAllPoints.size() can be smaller than the number of inserted points.
Voronoi2* GEOM_FADE25D::Fade_2D::getVoronoiDiagram | ( | ) |
bool GEOM_FADE25D::Fade_2D::hasArea | ( | ) | const |
As long as all inserted points are collinear the triangulation does not contain triangles. This is clearly the case as long as less than three input points are present but it may also be the case when 3 or more points have been inserted when all these points are collinear. These points are then in a pending state, i.e. they will be triangulated as soon as the first non-collinear point is inserted.
Zone2* GEOM_FADE25D::Fade_2D::importTriangles | ( | std::vector< Point2 > & | vPoints, |
bool | bReorientIfNeeded, | ||
bool | bCreateExtendedBoundingBox | ||
) |
This method imports triangles into an empty Fade object. The triangles do not need to satisfy the empty circle property.
vPoints | contains the input vertices (3 subsequent ones per triangle) |
bReorientIfNeeded | specifies if the orientations of the point triples shall be checked and corrected. If the point triples are certainly oriented in counterclockwise order then the orientation test can be skipped. |
bCreateExtendedBoundingBox | can be used to insert 4 dummy points of an extended bounding box. This is convenient in some cases. Use false if you are unsure. |
void GEOM_FADE25D::Fade_2D::insert | ( | CloudPrepare * | pCloudPrepare, |
bool | bClear = true |
||
) |
[in] | pCloudPrepare | is a CloudPrepare object that contains a point cloud |
[in] | bClear | determines whether pCloudPrepare shall be cleared during the operation in order to save memory. Always use bClear=true unless you plan to use pCloudPrepare also for other triangulations. |
p | is the point to be inserted. |
The triangulation keeps a copy of p. The return value is a pointer to this copy. If duplicate points are inserted, the triangulation does not create new copies but returns a pointer to the copy of the very first insertion.
void GEOM_FADE25D::Fade_2D::insert | ( | const std::vector< Point2 > & | vInputPoints | ) |
vInputPoints | contains the points to be inserted. |
void GEOM_FADE25D::Fade_2D::insert | ( | const std::vector< Point2 > & | vInputPoints, |
std::vector< Point2 * > & | vHandles | ||
) |
vInputPoints | contains the points to be inserted. |
vHandles | (empty) is used by Fade to return Point2 pointers |
Internally, the triangulation keeps copies of the inserted points which are returned in vHandles (in the same order). If duplicate points are contained in vInputPoints then only one copy will be made and a pointer to this unique copy will be stored in vHandles for every occurance.
void GEOM_FADE25D::Fade_2D::insert | ( | int | numPoints, |
double * | aCoordinates, | ||
Point2 ** | aHandles | ||
) |
numPoints | is the number of points to be inserted |
aCoordinates | is an array of 3n double values, e.g. {x0,y0,z0,x1,y1,z1,...,xn,yn,zn} |
aHandles | is an array with size n where pointers to the inserted points will be stored |
Returns whether the edge (p0,p1) is a constraint edge.
bool GEOM_FADE25D::Fade_2D::isConstraint | ( | Point2 * | pVtx | ) | const |
Returns whether the vertex pVtx
belongs to a constraint edge.
bool GEOM_FADE25D::Fade_2D::isConstraint | ( | Triangle2 * | pT, |
int | ith | ||
) | const |
Returns whether the edge in triangle pT which is opposite to the ith vertex is a constraint edge.
bool GEOM_FADE25D::Fade_2D::load | ( | const char * | filename, |
std::vector< Zone2 * > & | vZones | ||
) |
Loads a triangulation together with any custom indices, constraint-edges and zones from a binary file
[in] | filename | is the name of the input file |
[out] | vZones | is used to return Zone2* pointers if any. The order of the pointers is the same as at the time of storage |
bool GEOM_FADE25D::Fade_2D::load | ( | std::istream & | stream, |
std::vector< Zone2 * > & | vZones | ||
) |
Loads a triangulation together with any custom indices, constraint-edges and zones from a stream
stream | is an input stream | |
[out] | vZones | is used to return Zone2* pointers if any. The order of the pointers is the same as at the time of storage |
double GEOM_FADE25D::Fade_2D::measureTriangulationTime | ( | const std::vector< Point2 > & | vPoints | ) |
This method evaluates the performance of single- and multithreaded point insertion into a Delaunay triangulation.
[in] | vPoints | are the points to be inserted |
size_t GEOM_FADE25D::Fade_2D::numberOfPoints | ( | ) | const |
size_t GEOM_FADE25D::Fade_2D::numberOfTriangles | ( | ) | const |
void GEOM_FADE25D::Fade_2D::refine | ( | Zone2 * | pZone, |
double | minAngleDegree, | ||
double | minEdgeLength, | ||
double | maxEdgeLength, | ||
bool | bAllowConstraintSplitting | ||
) |
Creates a mesh inside the area given by a Zone2 object.
pZone | is the zone whose triangles are refined. Allowed zoneLocation values are ZL_INSIDE and ZL_BOUNDED. |
minAngleDegree | (up to 30) is the minimum interior triangle angle |
minEdgeLength | is a lower threshold on the edge length. Triangles with smaller edges are not refined. |
maxEdgeLength | is an upper threshold on the edge length. Triangles with larger edges are always refined. |
bAllowConstraintSplitting | specifies if constraint edges may be splitted |
void GEOM_FADE25D::Fade_2D::refineAdvanced | ( | MeshGenParams * | pParameters | ) |
This method calls an advanced Delaunay mesh generator and grid mesher. The parameters are encapsulated in the MeshGenParams class. This class provides default parameters that can be used as is. Alternatively client code can derive from MeshGenParams and overwrite the methods and parameters to gain full control over the mesh generation process.
void GEOM_FADE25D::Fade_2D::remove | ( | Point2 * | pVertex | ) |
pVertex | shall be removed. |
pVertex
must not be a vertex of a ConstraintGraph2 or ConstraintSegment2 object. If this is the case, the vertex is not removed and a warning is issued. void GEOM_FADE25D::Fade_2D::remove | ( | std::vector< Point2 * > & | vPoints | ) |
vPoints | are the points to be removed |
vPoints
must not be vertices of any ConstraintGraph2 or ConstraintSegment2 object. In this case the vertex is not removed. void GEOM_FADE25D::Fade_2D::reset | ( | ) |
Resets the triangulation and makes it re-usable.
bool GEOM_FADE25D::Fade_2D::saveTriangulation | ( | const char * | filename, |
std::vector< Zone2 * > & | vSaveZones | ||
) |
The saveTriangulation() command saves all triangles of the present triangulation to a binary file. Thereby it retains constraint edges and custom vertex indices, if any. If Zone2* pointers are specified, these zones will be saved also and their order will be retained.
[in] | filename | is the name of the output file |
[in] | vSaveZones | is used specify zones that shall additionally be saved |
bool GEOM_FADE25D::Fade_2D::saveTriangulation | ( | std::ostream & | stream, |
std::vector< Zone2 * > & | vSaveZones | ||
) |
The saveTriangulation() command saves all triangles of the present triangulation to a stream. Thereby it retains constraint edges and custom vertex indices, if any. If Zone2* pointers are specified, these zones will be saved also and their order will be retained.
stream | is the output stream | |
[out] | vSaveZones | is used specify zones that shall additionally be saved |
bool GEOM_FADE25D::Fade_2D::saveZones | ( | const char * | filename, |
std::vector< Zone2 * > & | vSaveZones | ||
) |
The saveZones() command saves the triangles of the zones in vSaveZones
to a binary file. Thereby it keeps the order of the zones and it retains any constraint edges and custom indices in the domain.
[in] | filename | is the name of the output file |
[out] | vSaveZones | (non-empty) specifies the zones to be saved |
bool GEOM_FADE25D::Fade_2D::saveZones | ( | std::ostream & | stream, |
std::vector< Zone2 * > & | vSaveZones | ||
) |
The saveZones() command saves the triangles of the zones in vSaveZones
to stream. Thereby it keeps the order of the zones and it retains any constraint edges and custom indices in the domain.
stream | is the name of output stream | |
[out] | vSaveZones | (non-empty) specifies the zones to be saved |
void GEOM_FADE25D::Fade_2D::setFastMode | ( | bool | bFast | ) |
By default, numerically perfect calculations are performed to compute a 100% perfect Delaunay triangulation. However, the quality difference to using double precision arithmetic is hardly noticeable. It is often rather relevant in scientific applications while practical applications may want to skip the computationally expensive calculations. Depending on the position of the input points, the effect of FastMode can be zero or a quite considerable acceleration.
bFast | use true to avoid using multiple precision arithmetic in favor of better performance. |
int GEOM_FADE25D::Fade_2D::setNumCPU | ( | int | numCPU | ) |
void GEOM_FADE25D::Fade_2D::show | ( | const char * | postscriptFilename, |
bool | bWithConstraints = true |
||
) | const |
show() is a convenience function for quick outputs with a default look. It is also possible to use the Visualizer2 class directly to draw arbitrary circles, line segments, vertices and labels with custom colors.
postscriptFilename | is the output name, i.e. "myFile.ps" |
bWithConstraints | specifies if constraint segments shall be shown (default: true) |
void GEOM_FADE25D::Fade_2D::show | ( | Visualizer2 * | pVis, |
bool | bWithConstraints = true |
||
) | const |
This overload of the show() method allows to add further geometric primitives to the Visualizer2 object before it is finally written.
pVis | is the pointer of a Visualizer2 object that may already contain geometric primitives or that may later be used to draw further elements |
bWithConstraints | specifies if constraint segments shall be shown (default: true) |
void GEOM_FADE25D::Fade_2D::showGeomview | ( | const char * | filename, |
const char * | color = "1 1 1 0.5" |
||
) | const |
filename | is the output filename |
color | is by default white (red:1,green:1,blue:1,alpha:0.5) |
void GEOM_FADE25D::Fade_2D::showGeomview | ( | Visualizer3 * | pVis, |
const char * | color = "1 1 1 0.5" |
||
) | const |
pVis | points to a Visualizer3 object |
color | is by default white (red:1,green:1,blue:1,alpha:0.5) |
void GEOM_FADE25D::Fade_2D::statistics | ( | const char * | s | ) | const |
Prints mesh statistics to stdout.
void GEOM_FADE25D::Fade_2D::subscribe | ( | MsgType | msgType, |
MsgBase * | pMsg | ||
) |
msgType | is the type of message the subscriber shall receive, e.g. MSG_PROGRESS or MSG_WARNING |
pMsg | is a pointer to a custom class derived from MsgBase |
void GEOM_FADE25D::Fade_2D::unsubscribe | ( | MsgType | msgType, |
MsgBase * | pMsg | ||
) |
msgType | is the type of message the subscriber shall not receive anymore |
pMsg | is a pointer to a custom class derived from MsgBase |
void GEOM_FADE25D::Fade_2D::writeObj | ( | const char * | filename | ) | const |
Visualizes the current triangulation. The *.obj format represents a 3D scene.
void GEOM_FADE25D::Fade_2D::writeObj | ( | const char * | filename, |
Zone2 * | pZone | ||
) | const |
Visualizes a certain Zone2 object of the present triangulation. The *.obj format represents a 3D scene.
void GEOM_FADE25D::Fade_2D::writeWebScene | ( | const char * | path | ) | const |
Made for terrain visualizations in 2.5D but will work also for 2D.
void GEOM_FADE25D::Fade_2D::writeWebScene | ( | const char * | path, |
Zone2 * | pZone | ||
) | const |
Made for terrain visualizations in 2.5D but will work also for 2D.