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

Iterator for all triangles around a given vertex. More...

#include <TriangleAroundVertexIterator.h>

Public Member Functions

 TriangleAroundVertexIterator (const Point2 *pPnt_)
 Constructor. More...
 
 TriangleAroundVertexIterator (Point2 *pPnt_, Triangle2 *pTr_)
 Constructor. More...
 
 TriangleAroundVertexIterator (const TriangleAroundVertexIterator &it)
 Copy constructor. More...
 
TriangleAroundVertexIteratoroperator= (const TriangleAroundVertexIterator &other)
 
TriangleAroundVertexIteratoroperator++ ()
 Proceed to the next triangle (the one in counterclockwise order) More...
 
TriangleAroundVertexIteratoroperator-- ()
 Proceed to the previous triangle (the one in clockwise order) More...
 
bool operator== (const TriangleAroundVertexIterator &rhs)
 operator==() More...
 
bool operator!= (const TriangleAroundVertexIterator &rhs)
 operator!=() More...
 
Triangle2operator* ()
 Returns a pointer to the current triangle (or NULL) More...
 
Triangle2previewNextTriangle ()
 Preview next triangle (CCW direction) More...
 
Triangle2previewPrevTriangle ()
 Preview previous triangle (CW direction) More...
 

Protected Member Functions

void loop ()
 

Protected Attributes

const Point2pPnt
 
Triangle2pTr
 
Triangle2pSavedTr
 

Detailed Description

Iterator for all triangles around a given vertex.

The TriangleAroundVertexIterator iterates over all triangles incident to a given vertex of a Fade_2D instance. The advantage is that the incident triangles can be visited in a certain order, namely counterclockwise with operator++() or clockwise using operator--(). If the order is not important you can use Fade_2D::getIncidentTriangles() instead.

Left: the iterator visits the triangles around a vertex in a circular manner. Right: Incrementing/decrementing the iterator at a border triangle makes it point to NULL and another increment/decrement sets it to the next border triangle

Constructor & Destructor Documentation

◆ TriangleAroundVertexIterator() [1/3]

TriangleAroundVertexIterator::TriangleAroundVertexIterator ( const Point2 pPnt_)
inlineexplicit

Constructor.

Parameters
pPnt_is the vertex whose incident triangles can be visited with the iterator

Initially the iterator points to an arbitrary triangle (not NULL)

◆ TriangleAroundVertexIterator() [2/3]

TriangleAroundVertexIterator::TriangleAroundVertexIterator ( Point2 pPnt_,
Triangle2 pTr_ 
)
inline

Constructor.

Parameters
pPnt_is the vertex whose incident triangles can be visited with the iterator
pTr_is the triangle the iterator initially points to

◆ TriangleAroundVertexIterator() [3/3]

TriangleAroundVertexIterator::TriangleAroundVertexIterator ( const TriangleAroundVertexIterator it)
inline

Copy constructor.

Copies the iterator it

Member Function Documentation

◆ operator!=()

bool TriangleAroundVertexIterator::operator!= ( const TriangleAroundVertexIterator rhs)
inline

operator!=()

Compares the center and the current triangle of *this and rhs

Returns
true when they are different, false otherwise

◆ operator*()

Triangle2* TriangleAroundVertexIterator::operator* ( )
inline

Returns a pointer to the current triangle (or NULL)

Dereferencing the iterator yields a pointer to the triangle to which the iterator points.

Warning
This method might yield NULL at the border of a triangulation.

◆ operator++()

TriangleAroundVertexIterator& TriangleAroundVertexIterator::operator++ ( )
inline

Proceed to the next triangle (the one in counterclockwise order)

Moves the iterator to the next triangle in counterclockwise order.

Warning
At the border of a triangulation, two border edges exist which are incident to the center vertex. Consequently, the neighbor triangles are NULL there. If operator++() leads the iterator off the triangulation then the iterator will point to NULL. Another call to operator++() will set the iterator to the next triangle in counterclockwise order.

◆ operator--()

TriangleAroundVertexIterator& TriangleAroundVertexIterator::operator-- ( )
inline

Proceed to the previous triangle (the one in clockwise order)

Moves the iterator to the next triangle in clockwise order.

Warning
At the border of a triangulation, two border edges are incident to the center vertex. Consequently, the neighbor triangles are NULL there. If operator--() leads the iterator off the triangulation then the iterator will point to NULL. Another call to operator--() will set the iterator to the next triangle in clockwise order.

◆ operator==()

bool TriangleAroundVertexIterator::operator== ( const TriangleAroundVertexIterator rhs)
inline

operator==()

Compares the center and the current triangle of *this and rhs

Returns
true when they are identically or false otherwise

◆ previewNextTriangle()

Triangle2* TriangleAroundVertexIterator::previewNextTriangle ( )
inline

Preview next triangle (CCW direction)

Returns
the next triangle (the one in CCW direction) without changing the current position.
Warning
This method might yield NULL at the border of a triangulation.

◆ previewPrevTriangle()

Triangle2* TriangleAroundVertexIterator::previewPrevTriangle ( )
inline

Preview previous triangle (CW direction)

Returns
the previous triangle (the one in CW direction) without changing the current position.
Warning
This method might yield NULL at the border of a triangulation.

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