Fade2.5D Documentation pages v1.85
Delaunay Features
Zone2 Class Reference

Zone2 is a certain defined area of a triangulation. More...

#include <Zone2.h>

Public Member Functions

void subscribe (MsgType msgType, MsgBase *pMsg)
 Register a message receiver. More...
 
void unsubscribe (MsgType msgType, MsgBase *pMsg)
 Unregister a message receiver. More...
 
ZoneLocation getZoneLocation () const
 Get the zone location. More...
 
Zone2convertToBoundedZone ()
 Convert a zone to a bounded zone. More...
 
void show (const char *postscriptFilename, bool bShowFull, bool bWithConstraints) const
 Postscript visualization. More...
 
void show (Visualizer2 *pVisualizer, bool bShowFull, bool bWithConstraints) const
 Postscript visualization. More...
 
void unifyGrid (double tolerance)
 
void getTriangles (std::vector< Triangle2 * > &vTriangles_) const
 Get the triangles of the zone. More...
 
void getVertices (std::vector< Point2 * > &vVertices_) const
 Get the vertices of the zone. More...
 
void statistics (const char *s) const
 
ConstraintGraph2getConstraintGraph () const
 Get the associated constraint. More...
 
size_t getNumberOfTriangles () const
 Get the number of triangles. More...
 
void getConstraintGraphs (std::vector< ConstraintGraph2 * > &vConstraintGraphs_) const
 Get the associated constraint graphs. More...
 
size_t numberOfConstraintGraphs () const
 Get a the number of ConstraintGraph2 objects. More...
 
void debug (const char *name="")
 Development function.
 
Bbox2 getBoundingBox () const
 Compute the bounding box.
 
void getBoundaryEdges (std::vector< Edge2 > &vEdges) const
 Compute the boundary edges of the zone.
 
void getBoundarySegments (std::vector< Segment2 > &vSegments) const
 Compute the boundary segments of the zone.
 
double getArea2D () const
 Get 2D Area. More...
 
void getBorderEdges (std::vector< Edge2 > &vBorderEdgesOut) const
 Get border edges. More...
 
void writeObj (const char *outFilename) const
 Write the zone to *.obj Writes the triangles of the present Zone2 to an *.obj file (The *.obj format represents a 3D scene). More...
 

Protected Attributes

Dt2 * pDt
 
Progress * pZoneProgress
 
ZoneLocation zoneLoc
 

Friends

Zone2zoneUnion (Zone2 *pZone0, Zone2 *pZone1)
 Compute the union of two zones. More...
 
Zone2zoneIntersection (Zone2 *pZone0, Zone2 *pZone1)
 Compute the intersection of two zones. More...
 
Zone2zoneDifference (Zone2 *pZone0, Zone2 *pZone1)
 Compute the difference of two zones. More...
 
Zone2zoneSymmetricDifference (Zone2 *pZone0, Zone2 *pZone1)
 Compute the symmetric difference of two zones. More...
 
Zone2peelOffIf (Zone2 *pZone, UserPredicateT *pPredicate, bool bVerbose)
 

Detailed Description

Member Function Documentation

◆ convertToBoundedZone()

Zone2* Zone2::convertToBoundedZone ( )

Convert a zone to a bounded zone.

The mesh generation algorithms refine() and refineAdvanced() require a zone object that is bounded by constraint segments. This is always the case for zones with zoneLocation ZL_INSIDE but other types of zones may be unbounded. For convenience this method is provided to create a bounded zone from a possibly unbounded one.

Returns
a pointer to a new Zone2 object with zoneLocation ZL_RESULT_BOUNDED or this if this->getZoneLocation() is ZL_INSIDE.

◆ getArea2D()

double Zone2::getArea2D ( ) const

Get 2D Area.

Returns the 2D area of the zone.

Note: The getArea() method is deprecated and replaced by getArea2D() and getArea25D()

◆ getBorderEdges()

void Zone2::getBorderEdges ( std::vector< Edge2 > &  vBorderEdgesOut) const

Get border edges.

Returns
: the CCW oriented border edges of the zone

◆ getConstraintGraph()

ConstraintGraph2* Zone2::getConstraintGraph ( ) const

Get the associated constraint.

Returns
a pointer to the ConstraintGraph2 object which defines the zone.
or NULL for ZL_RESULT-, ZL_GROW and ZL_GLOBAL_-zones.

◆ getConstraintGraphs()

void Zone2::getConstraintGraphs ( std::vector< ConstraintGraph2 * > &  vConstraintGraphs_) const

Get the associated constraint graphs.

◆ getNumberOfTriangles()

size_t Zone2::getNumberOfTriangles ( ) const

Get the number of triangles.

Warning
This method is fast but O(n), so don't call it frequently in a loop.

◆ getTriangles()

void Zone2::getTriangles ( std::vector< Triangle2 * > &  vTriangles_) const

Get the triangles of the zone.

This command fetches the existing triangles of the zone.

Note
Fade_2D::void applyConstraintsAndZones() must be called after the last insertion of points and constraints.
that the lifetime of data from the Fade2D datastructures does exceed the lifetime of the Fade2D object.

◆ getVertices()

void Zone2::getVertices ( std::vector< Point2 * > &  vVertices_) const

Get the vertices of the zone.

◆ getZoneLocation()

ZoneLocation Zone2::getZoneLocation ( ) const

Get the zone location.

Returns
ZL_INSIDE if the zone applies to the triangles inside one or more ConstraintGraph2 objects
ZL_OUTSIDE if the zone applies to the outside triangles
ZL_GLOBAL if the zone applies (dynamically) to all triangles
ZL_RESULT if the zone is the result of a set operation
ZL_GROW if the zone is specified by a set of constraint graphs and an inner point
An ouside zone and in inside zone

◆ numberOfConstraintGraphs()

size_t Zone2::numberOfConstraintGraphs ( ) const

Get a the number of ConstraintGraph2 objects.

A Zone2 object might be defined by zero, one or more ConstraintGraph2 objects.

◆ show() [1/2]

void Zone2::show ( const char *  postscriptFilename,
bool  bShowFull,
bool  bWithConstraints 
) const

Postscript visualization.

Parameters
postscriptFilenameis the name of the output file.
bShowFullspecifies if only the zone or the full triangulation shall be drawn
bWithConstraintsspecifies if constraint edges shall be drawn

◆ show() [2/2]

void Zone2::show ( Visualizer2 pVisualizer,
bool  bShowFull,
bool  bWithConstraints 
) const

Postscript visualization.

Parameters
pVisualizeris a pointer to an existing Visualizer2 object.
Note
You must call pVisualizer->writeFile() before program end
Parameters
bShowFullspecifies if only the zone or the full triangulation shall be drawn
bWithConstraintsspecifies if constraint edges shall be drawn

◆ statistics()

void Zone2::statistics ( const char *  s) const

Statistics

Prints statistics to stdout.

◆ subscribe()

void Zone2::subscribe ( MsgType  msgType,
MsgBase pMsg 
)

Register a message receiver.

Parameters
msgTypeis the type of message the subscriber shall receive, e.g. MSG_PROGRESS or MSG_WARNING
pMsgis a pointer to a custom class derived from MsgBase

◆ unifyGrid()

void Zone2::unifyGrid ( double  tolerance)

Unify Grid

A Delaunay triangulation not unique when when 2 or more triangles share a common circumcircle. As a consequence the four corners of a rectangle can be triangulated in two different ways: Either the diagonal proceeds from the lower left to the upper right corner or it connects the other two corners. Both solutions are valid and an arbitrary one is applied when points are triangulated. To improve the repeatability and for reasons of visual appearance this method unifies such diagonals to point from the lower left to the upper right corner (or in horizontal direction).

Parameters
toleranceis 0 when only exact cases of more than 3 points on a common circumcircle shall be changed. But in practice input data can be disturbed by noise and tiny rounding errors such that grid points are not exactly on a grid. The numeric error is computed as $error=\frac{abs(diagonalA-diagonalB)}{max(diagonalA,diagonalB)}$. and tolerance is an upper threshold to allow modification despite such tiny inaccuracies. Use with caution, such flips break the empty circle property and this may or may not fit your setting.

◆ unsubscribe()

void Zone2::unsubscribe ( MsgType  msgType,
MsgBase pMsg 
)

Unregister a message receiver.

Parameters
msgTypeis the type of message the subscriber shall not receive anymore
pMsgis a pointer to a custom class derived from MsgBase

◆ writeObj()

void Zone2::writeObj ( const char *  outFilename) const

Write the zone to *.obj Writes the triangles of the present Zone2 to an *.obj file (The *.obj format represents a 3D scene).

Parameters
outFilenameis the output filename

Friends And Related Function Documentation

◆ zoneDifference

Zone2* zoneDifference ( Zone2 pZone0,
Zone2 pZone1 
)
friend

Compute the difference of two zones.

Returns
a new zone containing the triangles of *pZone0 minus the ones of *pZone1
Note
pZone0 and pZone1 must belong to the same Fade_2D object.

◆ zoneIntersection

Zone2* zoneIntersection ( Zone2 pZone0,
Zone2 pZone1 
)
friend

Compute the intersection of two zones.

Returns
a new zone containing the intersection of *pZone0 and *pZone1
Note
pZone0 and pZone1 must belong to the same Fade_2D object.

◆ zoneSymmetricDifference

Zone2* zoneSymmetricDifference ( Zone2 pZone0,
Zone2 pZone1 
)
friend

Compute the symmetric difference of two zones.

Returns
a new zone containing the triangles that are present in one of the zones but not in the other one.
Note
pZone0 and pZone1 must belong to the same Fade_2D object.

◆ zoneUnion

Zone2* zoneUnion ( Zone2 pZone0,
Zone2 pZone1 
)
friend

Compute the union of two zones.

Returns
a new zone containing the union of the triangles of *pZone0 and *pZone1
Note
pZone0 and pZone1 must belong to the same Fade_2D object.

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