Fade2.5D Documentation pages v2.16.7
Delaunay Features
GEOM_FADE25D::ConstraintGraph2 Class Reference

A constraint graph is a collection of constraint edges (ConstraintSegment2). More...

#include <ConstraintGraph2.h>

Public Member Functions

CLASS_DECLSPEC ConstraintGraph2 (Dt2 *pDt2_, std::vector< ConstraintSegment2 * > &vCSegments, ConstraintInsertionStrategy)
 
CLASS_DECLSPEC ConstraintGraph2 (Dt2 *pDt2_, std::vector< ConstraintSegment2 * > &vCSegments_, std::map< std::pair< Point2 *, Point2 * >, bool > mPPReverse, ConstraintInsertionStrategy cis_)
 
CLASS_DECLSPEC void getChildConstraintSegments (std::vector< ConstraintSegment2 * > &vConstraintSegments_) const
 Get the current ConstraintSegment2 objects. More...
 
CLASS_DECLSPEC void getDirectChildren (ConstraintSegment2 *pParent, ConstraintSegment2 *&pChild0, ConstraintSegment2 *&pChild1)
 Get the direct children of a ConstraintSegment2. More...
 
CLASS_DECLSPEC ConstraintInsertionStrategy getInsertionStrategy () const
 Gets the constraint insertion strategy. More...
 
CLASS_DECLSPEC void getOriginalConstraintSegments (std::vector< ConstraintSegment2 * > &vConstraintSegments_) const
 Gets the original ConstraintSegment2 objects. More...
 
CLASS_DECLSPEC void getPolygonVertices (std::vector< Point2 * > &vVertices)
 Retrieves the vertices of the constraint segments. More...
 
void init (std::vector< ConstraintSegment2 * > &vCSegments_)
 
CLASS_DECLSPEC bool isConstraint (ConstraintSegment2 *pCSeg) const
 Checks if a ConstraintSegment2 is part of the current ConstraintGraph2. More...
 
CLASS_DECLSPEC bool isConstraint (Point2 *p0, Point2 *p1) const
 Check if an edge is a ConstraintSegment2 of the current ConstraintGraph2. More...
 
bool isDualOwned (ConstraintSegment2 *pCSeg)
 
CLASS_DECLSPEC bool isOriented () const
 Checks if the segments of the ConstraintGraph2 are oriented. More...
 
CLASS_DECLSPEC bool isPolygon () const
 Checks if the constraint graph forms a closed polygon. More...
 
CLASS_DECLSPEC bool isReverse (ConstraintSegment2 *pCSeg) const
 Get the orientation of a ConstraintSegment2. More...
 
CLASS_DECLSPEC bool makeDelaunay (double minLength)
 Improves the triangle quality (makes Delaunay). More...
 
CLASS_DECLSPEC void show (const char *name)
 Visualizes the ConstraintGraph2 as a PostScript or PDF file. More...
 
CLASS_DECLSPEC void show (Visualizer2 *pVis, const Color &color)
 Visualizes the ConstraintGraph2 as a PostScript or PDF file. More...
 

Protected Attributes

bool bIsOriented
 
bool bIsPolygon
 
ConstraintInsertionStrategy cis
 
std::map< ConstraintSegment2 *, bool, func_ltDerefPtr< ConstraintSegment2 * > > mCSegReverse
 
std::map< Point2 *, size_t > mSplitPointNum
 
Dt2 * pDt2
 
GeomTest * pGeomPredicates
 
std::vector< ConstraintSegment2 * > vCSegParents
 

Detailed Description

ConstraintGraph2 represents a graph formed by a collection of ConstraintSegment2 objects. It is used to represent fixed (constrained) edges in a Delaunay triangulation.

See also
Fade_2D::createConstraint()
Constrained Delaunay triangulation

Member Function Documentation

◆ getChildConstraintSegments()

CLASS_DECLSPEC void GEOM_FADE25D::ConstraintGraph2::getChildConstraintSegments ( std::vector< ConstraintSegment2 * > &  vConstraintSegments_) const

This method returns the ConstraintSegment2 objects in the current ConstraintGraph2, which may include the original segments or their child segments if they have been split.

Parameters
[out]vConstraintSegments_A vector of ConstraintSegment2 pointers.

◆ getDirectChildren()

CLASS_DECLSPEC void GEOM_FADE25D::ConstraintGraph2::getDirectChildren ( ConstraintSegment2 pParent,
ConstraintSegment2 *&  pChild0,
ConstraintSegment2 *&  pChild1 
)

Retrieves the direct children of the ConstraintSegment2 pParent, if it has been subdivided. If pParent has not been split, both pChild0 and pChild1 will be set to NULL.

Parameters
[in]pParentA ConstraintSegment2 that may have been split into child segments.
[out]pChild0,pChild1Used to return the direct children of pParent in the order they appear in the current ConstraintGraph2. These will be set to NULL if pParent has not been split.

◆ getInsertionStrategy()

CLASS_DECLSPEC ConstraintInsertionStrategy GEOM_FADE25D::ConstraintGraph2::getInsertionStrategy ( ) const

This method returns the ConstraintInsertionStrategy used for constructing the ConstraintGraph2.

Returns
The ConstraintInsertionStrategy used for constructing the ConstraintGraph2.
Note
The only supported ConstraintInsertionStrategy is CIS_CONSTRAINED_DELAUNAY. All other possible values are deprecated in favor of newer techniques.

◆ getOriginalConstraintSegments()

CLASS_DECLSPEC void GEOM_FADE25D::ConstraintGraph2::getOriginalConstraintSegments ( std::vector< ConstraintSegment2 * > &  vConstraintSegments_) const

This method retrieves the original ConstraintSegment2 objects used to construct the ConstraintGraph2. As a result of subdivision, these may no longer be alive and may have child segments recursively, i.e., the child segments may also have their own child segments, and so on.

Parameters
vConstraintSegments_A vector that will be populated with pointers to the original ConstraintSegment2 objects.

◆ getPolygonVertices()

CLASS_DECLSPEC void GEOM_FADE25D::ConstraintGraph2::getPolygonVertices ( std::vector< Point2 * > &  vVertices)

This method populates the provided vector with the vertices of the constraint segments in the current ConstraintGraph2. The ConstraintGraph2 may be discontinuous, and thus the vertices are returned in the format (a, b, b, c, c, d, ...), i.e., they may appear multiple times. The order of the vertices depends on how the ConstraintGraph2 was created:

  • If the ConstraintGraph2 was created with the bOrientedSegments parameter set to true, the vertices will be returned in their original order.
  • Otherwise, the segments may have been reordered as part of Fade_2D::createConstraint().

If any constraint segments have been split, the split points will also be included in the result. For example, if the ConstraintSegment2(a, b) was split at vertex x, the resulting order of vertices would be (a, x, x, b, b, c, c, d, ...).

Parameters
vVerticesA vector of Point2* that will be populated with the vertices of the constraint segments.
See also
Zone2::getBorderEdges()

◆ isConstraint() [1/2]

CLASS_DECLSPEC bool GEOM_FADE25D::ConstraintGraph2::isConstraint ( ConstraintSegment2 pCSeg) const

This method checks if the given ConstraintSegment2 is part of the current ConstraintGraph2.

Parameters
pCSegA pointer to the ConstraintSegment2 to check.
Returns
true if the ConstraintSegment2 is part of the graph, false otherwise.
Note
If a ConstraintSegment2 has been split, it is no longer alive and is not a member of the ConstraintGraph2 anymore. However, its child segments, if alive, are part of the ConstraintGraph2.

◆ isConstraint() [2/2]

CLASS_DECLSPEC bool GEOM_FADE25D::ConstraintGraph2::isConstraint ( Point2 p0,
Point2 p1 
) const

This method checks whether the edge defined by the points (p0, p1) is a ConstraintSegment2 in the current ConstraintGraph2. The order of the points (p0, p1) does not matter.

Returns
true if the edge (p0, p1) is a ConstraintSegment2 of the present ConstraintGraph2; false otherwise.

◆ isOriented()

CLASS_DECLSPEC bool GEOM_FADE25D::ConstraintGraph2::isOriented ( ) const

This method checks if the ConstraintGraph2 has been created with the parameter bOrientedSegments set to true or if it was automatically reoriented (which happens only for simple polygons).

Returns
true if the segments are oriented, false otherwise.

◆ isPolygon()

CLASS_DECLSPEC bool GEOM_FADE25D::ConstraintGraph2::isPolygon ( ) const

This method checks if the current constraint graph forms a closed polygon.

Returns
true if the constraint graph forms a closed polygon, false otherwise.
Note
This method does not check if the polygon is simple (i.e., has no self-intersections).

◆ isReverse()

CLASS_DECLSPEC bool GEOM_FADE25D::ConstraintGraph2::isReverse ( ConstraintSegment2 pCSeg) const

A ConstraintSegment2 pCSeg is unoriented because it may participate (with different orientations) in more than one ConstraintGraph2 objects and thus the vertices returned by pCSeg->getSrc() and pCSeg->getTrg() do not carry any orientation information. However, the orientation of pCSeg is stored in the ConstraintGraph2 objects where pCSeg is a member, and this method returns whether the source and target vertices need to be exchanged to match the present graph's direction.

◆ makeDelaunay()

CLASS_DECLSPEC bool GEOM_FADE25D::ConstraintGraph2::makeDelaunay ( double  minLength)

Insertion of constraint segments can make a triangulation locally non-Delaunay, meaning that the empty-circumcircle property does not hold for some triangles. This method subdivides the ConstraintSegment2 objects of the current ConstraintGraph2 so that they appear naturally as part of the Delaunay triangulation. This leads to visually more appealing triangles with better aspect ratios.

Parameters
[in]minLengthA lower bound for ConstraintSegment2 lengths. ConstraintSegment2s shorter than minLength will not be subdivided further. This parameter prevents excessive subdivision in geometrically narrow settings.
Returns
true if all required subdivisions have been carried out to restore the empty-circle property; false if further subdivision was prevented due to the minLength parameter.

◆ show() [1/2]

CLASS_DECLSPEC void GEOM_FADE25D::ConstraintGraph2::show ( const char *  name)

This method visualizes and saves the ConstraintGraph2 to a PostScript or PDF file, depending on the file extension.

Parameters
nameThe name of the output file.

◆ show() [2/2]

CLASS_DECLSPEC void GEOM_FADE25D::ConstraintGraph2::show ( Visualizer2 pVis,
const Color color 
)

This method takes a pointer to a Visualizer2 object and renders the current ConstraintGraph2.

Parameters
pVisA pointer to a Visualizer2 object.
colorThe color for the ConstraintGraph2.
Note
To finalize and save the visualization, you must call pVis->writeFile() after using this method.

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