Geom Software - C++ Programming and Geometry Libraries
Fade2D Documentation pages v1.52
GEOM_FADE2D::Zone2 Class Reference

Area in a triangulation. More...

#include <Zone2.h>

Public Member Functions

 Zone2 (Dt2 *pDt_, ZoneLocation zoneLoc_)
 
 Zone2 (Dt2 *pDt_, ZoneLocation zoneLoc_, ConstraintGraph2 *pConstraintGraph_)
 
 Zone2 (Dt2 *pDt_, ZoneLocation zoneLoc_, const std::vector< ConstraintGraph2 * > &vConstraintGraphs_)
 
 Zone2 (Dt2 *pDt_, const std::vector< ConstraintGraph2 * > &vConstraintGraphs_, ZoneLocation zoneLoc_, std::vector< Point2 > &vStartPoints)
 
ZoneLocation getZoneLocation () const
 Get the zone location. More...
 
Zone2convertToBoundedZone ()
 Convert a zone to a bounded zone. More...
 
void show (const std::string &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)
 
bool assignDt2 (Dt2 *pDt_)
 
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...
 
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...
 
Dt2 * getDelaunayTriangulation () const
 Get a pointer to the associated Delaunay triangulation.
 
size_t numberOfConstraintGraphs () const
 Get a the number of ConstraintGraph2 objects. More...
 
void debug (std::string 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...
 

Protected Member Functions

 Zone2 (const Zone2 &)
 
void getTriangles_RESULT (std::vector< Triangle2 * > &vTriangles) const
 
void initWorkspace (bool bInside, std::vector< Triangle2 * > &vWorkspace) const
 
void bfsFromWorkspace (std::vector< Triangle2 * > &vWorkspace, std::vector< Triangle2 * > &vTriangles) const
 
Zone2ctbz_treatCC (std::vector< Triangle2 * > &vOneCC)
 
void optimize (std::vector< Triangle2 * > &vT, std::vector< Triangle2 * > &vChangedT)
 

Protected Attributes

Dt2 * pDt
 
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

See also
createZone in the Fade2D class

Constructor & Destructor Documentation

GEOM_FADE2D::Zone2::Zone2 ( Dt2 *  pDt_,
ZoneLocation  zoneLoc_ 
)

internal use

GEOM_FADE2D::Zone2::Zone2 ( Dt2 *  pDt_,
ZoneLocation  zoneLoc_,
ConstraintGraph2 pConstraintGraph_ 
)

internal use

GEOM_FADE2D::Zone2::Zone2 ( Dt2 *  pDt_,
ZoneLocation  zoneLoc_,
const std::vector< ConstraintGraph2 * > &  vConstraintGraphs_ 
)

internal use

GEOM_FADE2D::Zone2::Zone2 ( Dt2 *  pDt_,
const std::vector< ConstraintGraph2 * > &  vConstraintGraphs_,
ZoneLocation  zoneLoc_,
std::vector< Point2 > &  vStartPoints 
)

internal use

Member Function Documentation

bool GEOM_FADE2D::Zone2::assignDt2 ( Dt2 *  pDt_)

internal use

Zone2* GEOM_FADE2D::Zone2::convertToBoundedZone ( )

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.
double GEOM_FADE2D::Zone2::getArea2D ( ) const

Returns the 2D area of the zone.

Note: The getArea() method is deprecated and replaced by getArea2D() to keep the names consistent.

void GEOM_FADE2D::Zone2::getBorderEdges ( std::vector< Edge2 > &  vBorderEdgesOut) const
Returns
: the CCW oriented border edges of the zone
ConstraintGraph2* GEOM_FADE2D::Zone2::getConstraintGraph ( ) const
Returns
a pointer to the ConstraintGraph2 object which defines the zone.
or NULL for ZL_RESULT-, ZL_GROW and ZL_GLOBAL_-zones.
void GEOM_FADE2D::Zone2::getConstraintGraphs ( std::vector< ConstraintGraph2 * > &  vConstraintGraphs_) const
size_t GEOM_FADE2D::Zone2::getNumberOfTriangles ( ) const
Warning
This method is fast but O(n), so don't call it frequently in a loop.
void GEOM_FADE2D::Zone2::getTriangles ( std::vector< Triangle2 * > &  vTriangles_) const

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. Otherwise the result won't be valid.
void GEOM_FADE2D::Zone2::getVertices ( std::vector< Point2 * > &  vVertices_) const
ZoneLocation GEOM_FADE2D::Zone2::getZoneLocation ( ) const
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
in_and_outside_zone.jpg
An ouside zone and in inside zone
size_t GEOM_FADE2D::Zone2::numberOfConstraintGraphs ( ) const

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

void GEOM_FADE2D::Zone2::show ( const std::string &  postscriptFilename,
bool  bShowFull,
bool  bWithConstraints 
) const
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
void GEOM_FADE2D::Zone2::show ( Visualizer2 pVisualizer,
bool  bShowFull,
bool  bWithConstraints 
) const
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
void GEOM_FADE2D::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.

Friends And Related Function Documentation

Zone2* zoneDifference ( Zone2 pZone0,
Zone2 pZone1 
)
friend
Returns
a new zone containing the triangles of *pZone0 minus the ones of *pZone1
Zone2* zoneIntersection ( Zone2 pZone0,
Zone2 pZone1 
)
friend
Returns
a new zone containing the intersection of *pZone0 and *pZone1
Zone2* zoneSymmetricDifference ( Zone2 pZone0,
Zone2 pZone1 
)
friend
Returns
a new zone containing the triangles that are present in one of the zones but not in the other one.
Zone2* zoneUnion ( Zone2 pZone0,
Zone2 pZone1 
)
friend
Returns
a new zone containing the union of the triangles of *pZone0 and *pZone1

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