** 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 | 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. | |
ConstraintSegment2 * | getNearbyBoundaryConstraint (Point2 &p, double tolerance) |
Locates the nearest boundary ConstraintSegment2 of the zone within a specified distance. More... | |
size_t | getNumberOfTriangles () const |
Get the number of triangles. More... | |
void | getOffsetBoundary (double offset, std::vector< Segment2 > &vOffsetBoundary, double mergeAngleDeg=10.0, double angleStepDeg=20.0) |
Get the boundary of an offset shape. 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... | |
bool | hasOn (const Point2 &p) |
Checks if the given point lies on the zone or its boundary. More... | |
bool | hasOnBoundary (const Point2 &p) |
Checks if the given point lies on the boundary of the zone. More... | |
Triangle2 * | locate (const Point2 &p) |
Locates the triangle containing the given point within the zone. 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... | |
bool | shiftToZone (const Point2 &from, double tolerance, Point2 &result) |
Finds a point close to the input point that lies inside the zone. More... | |
void | show (const char *filename, bool bShowFull, bool bWithConstraints) const |
Postscript- and PDF-visualization. More... | |
void | show (Visualizer2 *pVisualizer, bool bShowFull, bool bWithConstraints) const |
Postscript- and PDF-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 | showVtk (const char *filename, VtkColor zoneColor, VtkColor nonZoneColor=VTK_TRANSPARENT, VtkColor constraintColor=VTK_TRANSPARENT) const |
VTK visualization. More... | |
void | showVtk (VtkWriter *pVtk, VtkColor zoneColor, VtkColor nonZoneColor=VTK_TRANSPARENT, VtkColor constraintColor=VTK_TRANSPARENT) const |
VTK visualization. More... | |
void | slopeValleyRidgeOptimization (OptimizationMode om=OPTMODE_BETTER) |
Optimize Slopes, Valleys and Ridges. More... | |
void | smoothing (int numIterations=2, bool bWithXY=true) |
Smoothing. More... | |
void | smoothing2 (int numIterations, bool bWithXY, bool bWithConstraintZ) |
Smooths the vertices of the zone. 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... | |
bool | writePly (const char *filename, bool bASCII=false) const |
Write the zone to a *.ply file. More... | |
bool | writePly (std::ostream &os, bool bASCII=false) const |
Write the zone to a *.ply file. 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) |
Computes the difference between two Zone2 objects. More... | |
Zone2 * | zoneIntersection (Zone2 *pZone0, Zone2 *pZone1) |
Computes the intersection of two Zone2 objects. More... | |
Zone2 * | zoneSymmetricDifference (Zone2 *pZone0, Zone2 *pZone1) |
Computes the symmetric difference between two Zone2 objects. More... | |
Zone2 * | zoneUnion (Zone2 *pZone0, Zone2 *pZone1) |
Computes the union of two Zone2 objects. More... | |
**
Connected component with boundary- and hole polygons
Zone2 is a certain defined area of a triangulation
Zone2* GEOM_FADE25D::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.
void GEOM_FADE25D::Zone2::exportZone | ( | FadeExport & | fadeExport, |
bool | bWithCustomIndices | ||
) | const |
Export triangles from a zone.
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 |
Get 2.5D Area.
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 |
Get 2D Area.
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 |
Get border edges.
void GEOM_FADE25D::Zone2::getBoundarySegments | ( | std::vector< Segment2 > & | vSegments | ) | const |
Compute the boundary segments.
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 |
Get connected components and their boundary polygons.
This method subdivides the zone into connected components. For each connected component 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 the triangle belonging to the Zone2. Thus the outer boundary polygon is ccw-oriented while the polygons of inner holes are cw-oriented.
ConstraintGraph2* GEOM_FADE25D::Zone2::getConstraintGraph | ( | ) | const |
Get the associated constraint.
ConstraintSegment2* GEOM_FADE25D::Zone2::getNearbyBoundaryConstraint | ( | Point2 & | p, |
double | tolerance | ||
) |
Locates the nearest boundary ConstraintSegment2 of the zone within a specified distance.
p | The point from which to search. |
tolerance | The maximum allowed 2D distance between the point and the ConstraintSegment2. |
The first call to Zone2::hasOn(), Zone2::hasOnBoundary(), Zone2::getNearbyBoundaryConstraint(), Zone2::shiftToZone() or Zone2::locate() initializes a search structure. For zones not of type ZL_INSIDE, ZL_BOUNDED, or ZL_GLOBAL, constraint edges are inserted around the zone.
size_t GEOM_FADE25D::Zone2::getNumberOfTriangles | ( | ) | const |
Get the number of triangles.
void GEOM_FADE25D::Zone2::getOffsetBoundary | ( | double | offset, |
std::vector< Segment2 > & | vOffsetBoundary, | ||
double | mergeAngleDeg = 10.0 , |
||
double | angleStepDeg = 20.0 |
||
) |
Get the boundary of an offset shape.
This function computes a zone offset by a specified distance. The result is returned as a vector of oriented Segment2's.
offset | The positive or negative offset distance from the present zone. | |
[out] | vOffsetBoundary | A vector that will contain the output segments, in arbitrary order, oriented counterclockwise around the resulting shape. |
mergeAngleDeg | If the angle between two offset points of an original vertex is less than this value (in degrees), the points will be merged. Default: 10.0, valid range: greater than 0 and up to 135. | |
angleStepDeg | Specifies the angle interval (in degrees) at which circular arcs are sampled using line segments. Default: 20.0, valid range: greater than 0 and up to 135. |
void GEOM_FADE25D::Zone2::getTriangles | ( | std::vector< Triangle2 * > & | vTriangles_ | ) | const |
Get the triangles of the zone.
This command fetches the existing triangles of the zone.
ZoneLocation GEOM_FADE25D::Zone2::getZoneLocation | ( | ) | const |
Get the zone location.
bool GEOM_FADE25D::Zone2::hasOn | ( | const Point2 & | p | ) |
Checks if the given point lies on the zone or its boundary.
p | The point to check. |
The first call to Zone2::hasOn(), Zone2::hasOnBoundary(), Zone2::getNearbyBoundaryConstraint(), Zone2::shiftToZone() or Zone2::locate() initializes a search structure. For zones not of type ZL_INSIDE, ZL_BOUNDED, or ZL_GLOBAL, constraint edges are inserted around the zone.
bool GEOM_FADE25D::Zone2::hasOnBoundary | ( | const Point2 & | p | ) |
Checks if the given point lies on the boundary of the zone.
p | The point to check. |
The first call to Zone2::hasOn(), Zone2::hasOnBoundary(), Zone2::getNearbyBoundaryConstraint(), Zone2::shiftToZone() or Zone2::locate() initializes a search structure. For zones not of type ZL_INSIDE, ZL_BOUNDED, or ZL_GLOBAL, constraint edges are inserted around the zone.
Locates the triangle containing the given point within the zone.
p | The point to locate. |
The first call to Zone2::hasOn(), Zone2::hasOnBoundary(), Zone2::getNearbyBoundaryConstraint(), Zone2::shiftToZone() or Zone2::locate() initializes a search structure. For zones not of type ZL_INSIDE, ZL_BOUNDED, or ZL_GLOBAL, constraint edges are inserted around the zone.
size_t GEOM_FADE25D::Zone2::numberOfConstraintGraphs | ( | ) | const |
Get a the number of ConstraintGraph2 objects.
A Zone2 object might be defined by zero, one or more ConstraintGraph2 objects.
bool GEOM_FADE25D::Zone2::save | ( | const char * | filename | ) |
Save the zone.
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 | ) |
Save the zone.
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 |
Finds a point close to the input point that lies inside the zone.
from | A point outside the zone. |
tolerance | The maximum allowed 2D distance to find a point within the zone. |
result | A reference to store the point found within the zone, close to from . |
The first call to Zone2::hasOn(), Zone2::hasOnBoundary(), Zone2::getNearbyBoundaryConstraint(), Zone2::shiftToZone() or Zone2::locate() initializes a search structure. For zones not of type ZL_INSIDE, ZL_BOUNDED, or ZL_GLOBAL, constraint edges are inserted around the zone.
void GEOM_FADE25D::Zone2::show | ( | const char * | filename, |
bool | bShowFull, | ||
bool | bWithConstraints | ||
) | const |
Postscript- and PDF-visualization.
filename | 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 |
Postscript- and PDF-visualization.
pVisualizer | is a pointer to an existing Visualizer2 object drawing a .ps or .pdf 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::showGeomview | ( | const char * | filename, |
const char * | color | ||
) | const |
Geomview visualization.
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 |
Geomview visualization.
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::showVtk | ( | const char * | filename, |
VtkColor | zoneColor, | ||
VtkColor | nonZoneColor = VTK_TRANSPARENT , |
||
VtkColor | constraintColor = VTK_TRANSPARENT |
||
) | const |
VTK visualization.
filename | The name of the output file. |
zoneColor | The color for the zone's triangles |
nonZoneColor | The color of the non-zone-triangles. Use VTK_TRANSPARENT to prevent them from being drawn. |
constraintColor | The color of the constraint edges. Use VTK_TRANSPARENT to prevent them from being drawn. |
void GEOM_FADE25D::Zone2::showVtk | ( | VtkWriter * | pVtk, |
VtkColor | zoneColor, | ||
VtkColor | nonZoneColor = VTK_TRANSPARENT , |
||
VtkColor | constraintColor = VTK_TRANSPARENT |
||
) | const |
VTK visualization.
pVtk | A VtkWriter object that may already contain other geometric objects |
zoneColor | The color for the zone's triangles |
nonZoneColor | The color of the non-zone-triangles. Use VTK_TRANSPARENT to prevent them from being drawn. |
constraintColor | The color of the constraint edges. Use VTK_TRANSPARENT to prevent them from being drawn. |
void GEOM_FADE25D::Zone2::slopeValleyRidgeOptimization | ( | OptimizationMode | om = OPTMODE_BETTER | ) |
Optimize Slopes, Valleys and Ridges.
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 , |
bool | bWithXY = true |
||
) |
Smoothing.
Deprecated method: This method is deprecated and retained for backwards compatibility. It is recommended to use the new method smoothing2() instead for better results.
Weighted laplacian smoothing for the z-coordinate of all zone vertices. The x and y coordinates can also be optimized but only for vertices not belonging to the boundary of the zone or to constraint edges. This method is very fast but does nevertheless support the progress bar mechanism.
numIterations | is the number of smoothing passes. |
bWithXY | specifies if the x and y coordinates are also adapted. |
void GEOM_FADE25D::Zone2::smoothing2 | ( | int | numIterations, |
bool | bWithXY, | ||
bool | bWithConstraintZ | ||
) |
Smooths the vertices of the zone.
This function performs a weighted Laplacian smoothing on the vertices of the Zone2. We distinguish between two types of vertices:
numIterations | Number of smoothing iterations to perform. Higher values yield smoother results; 2-3 passes are recommended. |
bWithXY | Boolean flag to determine if the x- and y-coordinates of dynamic vertices should also be adjusted. |
bConstraintsWithZ | Boolean flag to control whether the z-coordinates of static vertices are also updated by the smoothing process. |
void GEOM_FADE25D::Zone2::statistics | ( | const char * | s | ) | const |
Statistics
Prints statistics to stdout.
void GEOM_FADE25D::Zone2::subscribe | ( | MsgType | msgType, |
MsgBase * | pMsg | ||
) |
Register a message receiver.
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 . 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. |
void GEOM_FADE25D::Zone2::unsubscribe | ( | MsgType | msgType, |
MsgBase * | pMsg | ||
) |
Unregister a message receiver.
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 |
Write the zone to *.obj Writes the triangles of the present Zone2 to an *.obj file (The *.obj format represents a 3D scene).
outFilename | is the output filename |
bool GEOM_FADE25D::Zone2::writePly | ( | const char * | filename, |
bool | bASCII = false |
||
) | const |
Write the zone to a *.ply file.
filename | is the output filename |
bASCII | specifies whether to write the *.ply in ASCII or binary format |
bool GEOM_FADE25D::Zone2::writePly | ( | std::ostream & | os, |
bool | bASCII = false |
||
) | const |
Write the zone to a *.ply file.
os | is the output file |
bASCII | specifies whether to write the *.ply in ASCII or binary format |
|
friend |
Peel off border triangles.
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 if no triangles remain.
|
friend |
Peel off border triangles (deprecated)
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 if no triangles remain. Computes the difference between two Zone2 objects.
This function returns a pointer to a new Zone2 object representing the difference between the two input zones. The difference is the area covered by the first zone that is not covered by the second zone. The input zones must belong to the same Fade_2D object.
NULL
. Computes the intersection of two Zone2 objects.
This function returns a pointer to a new Zone2 object representing the intersection of the two input zones. The intersection is the area covered by both of the input zones. The input zones must belong to the same Fade_2D object.
NULL
. Computes the symmetric difference between two Zone2 objects.
This function returns a pointer to a new Zone2 object representing the symmetric difference between the two input zones. The symmetric difference is the area covered by either of the input zones but not by both. The input zones must belong to the same Fade_2D object.
NULL
. Computes the union of two Zone2 objects.
This function returns a pointer to a new Zone2 object representing the union of the two input zones. The union is the area covered by either of the input zones. The input zones must belong to the same Fade_2D object.