Zone2 is a certain defined area of a triangulation. More...
#include <Zone2.h>
Public Member Functions | |
Zone2 * | convertToBoundedZone () |
Convert a zone to a bounded zone. More... | |
void | debug (const char *name="") |
Development function. | |
void | exportZone (FadeExport &fadeExport, bool bWithCustomIndices) const |
Export triangles from a zone. More... | |
double | getArea25D () const |
Get 2.5D Area. More... | |
double | getArea2D () const |
Get 2D Area. More... | |
void | getBorderEdges (std::vector< Edge2 > &vBorderEdgesOut) const |
Get border edges. More... | |
void | getBoundaryEdges (std::vector< Edge2 > &vEdges) const |
Compute the boundary edges. More... | |
void | getBoundarySegments (std::vector< Segment2 > &vSegments) const |
Compute the boundary segments. More... | |
Bbox2 | getBoundingBox () const |
Compute the bounding box. | |
void | getComponentPolygons (std::vector< CompPolygon > &vCompPolygons) const |
Get connected components and their boundary polygons. More... | |
ConstraintGraph2 * | getConstraintGraph () const |
Get the associated constraint. More... | |
void | getConstraintGraphs (std::vector< ConstraintGraph2 * > &vConstraintGraphs_) const |
Get the associated constraint graphs. | |
size_t | getNumberOfTriangles () const |
Get the number of triangles. More... | |
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. | |
ZoneLocation | getZoneLocation () const |
Get the zone location. More... | |
size_t | numberOfConstraintGraphs () const |
Get a the number of ConstraintGraph2 objects. More... | |
bool | save (const char *filename) |
Save the zone. More... | |
bool | save (std::ostream &stream) |
Save the 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 | showGeomview (const char *filename, const char *color) const |
Geomview visualization. More... | |
void | showGeomview (Visualizer3 *pVis, const char *color) const |
Geomview visualization. More... | |
void | slopeValleyRidgeOptimization (OptimizationMode om=OPTMODE_BETTER) |
Optimize Slopes, Valleys and Ridges. More... | |
void | smoothing (int numIterations=2) |
Smoothing. More... | |
void | statistics (const char *s) const |
void | subscribe (MsgType msgType, MsgBase *pMsg) |
Register a message receiver. More... | |
void | unifyGrid (double tolerance) |
void | unsubscribe (MsgType msgType, MsgBase *pMsg) |
Unregister a message receiver. 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 Member Functions | |
Zone2 & | operator= (const Zone2 &) |
Friends | |
Zone2 * | peelOffIf (Zone2 *pZone, bool bAvoidSplit, PeelPredicateTS *pPredicate) |
Peel off border triangles. More... | |
Zone2 * | peelOffIf (Zone2 *pZone, UserPredicateT *pPredicate, bool bVerbose) |
Peel off border triangles (deprecated) More... | |
Zone2 * | zoneDifference (Zone2 *pZone0, Zone2 *pZone1) |
Compute the difference of two zones. More... | |
Zone2 * | zoneIntersection (Zone2 *pZone0, Zone2 *pZone1) |
Compute the intersection of two zones. More... | |
Zone2 * | zoneSymmetricDifference (Zone2 *pZone0, Zone2 *pZone1) |
Compute the symmetric difference of two zones. More... | |
Zone2 * | zoneUnion (Zone2 *pZone0, Zone2 *pZone1) |
Compute the union of two zones. More... | |
Zone2* GEOM_FADE25D::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.
void GEOM_FADE25D::Zone2::exportZone | ( | FadeExport & | fadeExport, |
bool | bWithCustomIndices | ||
) | const |
fadeExport | is a struct that will hold the requested triangulation data |
bWithCustomIndices | determines whether the custom indices of the points are also stored |
double GEOM_FADE25D::Zone2::getArea25D | ( | ) | const |
Returns the 2.5D area of the zone.
Note: The getArea() method is deprecated and replaced by getArea2D() and getArea25D()
double GEOM_FADE25D::Zone2::getArea2D | ( | ) | const |
Returns the 2D area of the zone.
Note: The getArea() method is deprecated and replaced by getArea2D() and getArea25D()
void GEOM_FADE25D::Zone2::getBorderEdges | ( | std::vector< Edge2 > & | vBorderEdgesOut | ) | const |
void GEOM_FADE25D::Zone2::getBoundaryEdges | ( | std::vector< Edge2 > & | vEdges | ) | const |
Outputs the boundary edges of the zone. Edge2 elements are always ccw-oriented but the edges are not returned in any specific order.
void GEOM_FADE25D::Zone2::getBoundarySegments | ( | std::vector< Segment2 > & | vSegments | ) | const |
Outputs the boundary segments of the zone. These are ccw-oriented but not returned in any specific order.
void GEOM_FADE25D::Zone2::getComponentPolygons | ( | std::vector< CompPolygon > & | vCompPolygons | ) | const |
This method subdivides the zone into connected components. For each connected components it then returns a CompPolygon object consisting of the triangles, their outer boundary polygon and the hole polygons. Edges are represented by a triangle and an index and they are always counterclockwise (ccw) around their triangle. Thus the outer boundary polygon is also ccw-oriented while the polygons of inner holes are cw-oriented.
ConstraintGraph2* GEOM_FADE25D::Zone2::getConstraintGraph | ( | ) | const |
size_t GEOM_FADE25D::Zone2::getNumberOfTriangles | ( | ) | const |
void GEOM_FADE25D::Zone2::getTriangles | ( | std::vector< Triangle2 * > & | vTriangles_ | ) | const |
This command fetches the existing triangles of the zone.
ZoneLocation GEOM_FADE25D::Zone2::getZoneLocation | ( | ) | const |
size_t GEOM_FADE25D::Zone2::numberOfConstraintGraphs | ( | ) | const |
A Zone2 object might be defined by zero, one or more ConstraintGraph2 objects.
bool GEOM_FADE25D::Zone2::save | ( | const char * | filename | ) |
This command saves the present Zone2 to a binary file. Any constraint edges and custom indices in the domain are retained.
[in] | filename | is the output filename |
bool GEOM_FADE25D::Zone2::save | ( | std::ostream & | stream | ) |
This command saves the present Zone2 to an ostream. Any constraint edges and custom indices in the domain are retained.
stream | is the output stream |
void GEOM_FADE25D::Zone2::show | ( | const char * | postscriptFilename, |
bool | bShowFull, | ||
bool | bWithConstraints | ||
) | const |
postscriptFilename | is the name of the output file. |
bShowFull | specifies if only the zone or the full triangulation shall be drawn |
bWithConstraints | specifies if constraint edges shall be drawn |
void GEOM_FADE25D::Zone2::show | ( | Visualizer2 * | pVisualizer, |
bool | bShowFull, | ||
bool | bWithConstraints | ||
) | const |
pVisualizer | is a pointer to an existing Visualizer2 object. |
bShowFull | specifies if only the zone or the full triangulation shall be drawn |
bWithConstraints | specifies if constraint edges shall be drawn |
void GEOM_FADE25D::Zone2::showGeomview | ( | const char * | filename, |
const char * | color | ||
) | const |
filename | is the name of the output file. |
color | is a string ("red green blue alpha"), e.g., "1.0 0.0 0.0 1.0"* |
void GEOM_FADE25D::Zone2::showGeomview | ( | Visualizer3 * | pVis, |
const char * | color | ||
) | const |
pVis | points to a Visualizer3 object |
color | is a string ("red green blue alpha"), e.g., "1.0 0.0 0.0 1.0"* |
void GEOM_FADE25D::Zone2::slopeValleyRidgeOptimization | ( | OptimizationMode | om = OPTMODE_BETTER | ) |
A pure Delaunay triangulation takes only the x and y coordinates into account. However, for terrain scans, it is important to consider the z coordinate as well, otherwise ridges, valleys and rivers will look unnatural. This method leaves the points constant, but uses edge flips to change the connectivity, making the surface smoother overall.
om | is the optimization mode: OPTMODE_NORMAL is the fastest. OPTMODE_BETTER provides significantly better results while still taking a moderate amount of time. OPTMODE_BEST delivers the best results, but also has a significantly higher time requirement. This method supports the progress-bar mechanism. |
void GEOM_FADE25D::Zone2::smoothing | ( | int | numIterations = 2 | ) |
This method applies weighted laplacian smoothing to the vertices. It keeps boundary points and internal points belonging to constraint-edges constant. Nevertheless it is guaranteed that moving the vertices does not lead to self-intersections. This method is very fast, but for larger models it still supports the progress bar mechanism.
numIterations | specifies the number of smoothing passes. |
void GEOM_FADE25D::Zone2::statistics | ( | const char * | s | ) | const |
Statistics
Prints statistics to stdout.
void GEOM_FADE25D::Zone2::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::Zone2::unifyGrid | ( | double | tolerance | ) |
Unify Grid
A Delaunay triangulation is not unique when when 2 or more triangles lie on a common circle. 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).
tolerance | is 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 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. |
void GEOM_FADE25D::Zone2::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::Zone2::writeObj | ( | const char * | outFilename | ) | const |
outFilename | is the output filename |
|
friend |
pZone | is the input zone |
bAvoidSplit | if true, then the algorithm removes a triangle only if it does not break the zone into independent components. |
pPredicate | is a user-defined predicate that decides if a triangle shall be removed. |
pZone
or NULL when no triangles remain.
|
friend |
This function is DEPRECATED but kept for backwards compatibility. The new and better function is: peelOffIf(Zone2* pZone, bool bAvoidSplit,PeelPredicateTS* pPredicate)
pZone | |
pPredicate | |
bVerbose |
pZone
or NULL when no triangles remain. pZone0
and pZone1
must belong to the same Fade_2D object. pZone0
and pZone1
must belong to the same Fade_2D object. pZone0
and pZone1
must belong to the same Fade_2D object. pZone0
and pZone1
must belong to the same Fade_2D object.