Iterator for all triangles around a given vertex.
More...
#include <TriangleAroundVertexIterator.h>
The TriangleAroundVertexIterator
iterates over all triangles incident to a given vertex (Point2 pointer) of a Fade_2D instance. The iteration can be performed in counterclockwise order using operator++()
or in clockwise order using operator--()
.
Left: The iterator visits the triangles in CCW or CW order. Right: When the iterator at a border vertex points to NULL, another increment/decrement moves it to the next triangle.
A usage example is:
Point2* pVtx=...;
do
{
Triangle2* pT(*tavi);
if(pT==NULL)
{
std::cout<<"pT=NULL"<<std::endl;
continue;
}
std::cout<<"pT="<<pT<<std::endl;
} while(++tavi!=taviStop);
TriangleAroundVertexIterator(const Point2 *pPnt_)
Constructor.
Definition: TriangleAroundVertexIterator.h:92
- See also
Fade_2D::getIncidentTriangles()
is a simple method to retrieve all incident triangles.
◆ TriangleAroundVertexIterator() [1/3]
GEOM_FADE2D::TriangleAroundVertexIterator::TriangleAroundVertexIterator |
( |
const Point2 * |
pPnt_ | ) |
|
|
inlineexplicit |
Constructor
- Parameters
-
pPnt_ | The vertex whose incident triangles are traversed by the iterator. |
The iterator is initialized to point to an arbitrary triangle (not NULL).
◆ TriangleAroundVertexIterator() [2/3]
GEOM_FADE2D::TriangleAroundVertexIterator::TriangleAroundVertexIterator |
( |
Point2 * |
pPnt_, |
|
|
Triangle2 * |
pTr_ |
|
) |
| |
|
inline |
- Parameters
-
pPnt_ | The vertex whose incident triangles are traversed by the iterator. |
pTr_ | The triangle to which the iterator initially points. |
◆ TriangleAroundVertexIterator() [3/3]
- Parameters
-
it | The iterator to be copied. |
This constructor creates a copy of the iterator it
.
◆ operator!=()
Compares the center and the current triangle of the iterator and the given iterator (rhs
).
- Returns
true
if the iterators point to different triangles or vertices, false
otherwise.
◆ operator*()
Triangle2* GEOM_FADE2D::TriangleAroundVertexIterator::operator* |
( |
| ) |
|
|
inline |
Dereferencing the iterator returns a pointer to the triangle currently pointed to by the iterator.
- Warning
- This method might return NULL if the iterator is at the border of a triangulation.
◆ operator++()
Advances the iterator to the next triangle in counterclockwise (CCW) order.
- Warning
- If the iterator is at the border of a triangulation,
operator++()
can move the iterator beyond the triangulation, causing it to point to NULL. A subsequent call to operator++()
will move the iterator to the next triangle in counterclockwise order.
◆ operator--()
Advances the iterator to the previous triangle in clockwise (CW) order.
- Warning
- If the iterator is at the border of a triangulation,
operator--()
can move the iterator beyond the triangulation, causing it to point to NULL. A subsequent call to operator--()
will move the iterator to the next triangle in clockwise order.
◆ operator=()
- Parameters
-
other | The iterator to be assigned. |
This operator assigns the state of the iterator other
to the current iterator.
◆ operator==()
Compares the center and the current triangle of the iterator and the given iterator (rhs
).
- Returns
true
if the iterators point to the same vertex and triangle, false
otherwise.
◆ previewNextTriangle()
Triangle2* GEOM_FADE2D::TriangleAroundVertexIterator::previewNextTriangle |
( |
| ) |
|
|
inline |
This method returns the triangle the iterator would point to if it were incremented.
- Returns
- A pointer to the next triangle (in counterclockwise direction), without modifying the current position.
- Warning
- This method might return NULL if the iterator is at the border of a triangulation.
◆ previewPrevTriangle()
Triangle2* GEOM_FADE2D::TriangleAroundVertexIterator::previewPrevTriangle |
( |
| ) |
|
|
inline |
This method returns the triangle the iterator would point to if it were decremented.
- Returns
- A pointer to the previous triangle (in clockwise direction), without modifying the current position.
- Warning
- This method might return NULL if the iterator is at the border of a triangulation.
The documentation for this class was generated from the following file: