Mesh Iterators
There are several types of iterators available for working with the mesh topology. They are located in the header files halfedge_iterators.h and halfedge_range_iterators.h:
EdgeFanIterator is the iterator for traversing the edges of the vertex fan in a counterclockwise direction (see Fig. 1). Example of use:
for( EdgeFanIterator it( halfedge, iEd ); !it.Done(); ++it )
;
for( EdgeFanIterator it( halfedge, iVx, true ); !it.Done(); ++it ) {
if( it.Edge() < SYS_MAX_T ) {
...
}
if( it.Twin() < SYS_MAX_T ) {
...
}
}
Fig. 1
EdgeFacetIterator is the iterator for traversing facet edges, starting from the facet edge in a counterclockwise direction (see Fig. 2).
Example of use:
for( EdgeFacetIterator it( halfedge, iFacet ); !it.Done(); ++it ) {
const MbHalfedgeEdge & ed = halfedge.Edge( it.Edge() );
}
EdgesAroundFacetBegEndPair AllEdgesAroundFacet( size_t iFacet ) const;
Range based iterator for traversing facet edges, starting from the facet edge in a counterclockwise direction.
Example of use:
for( const MbHalfedgeEdge & ed : halfedge.AllEdgesAroundFacet( iFacet ) ) {
...
}
Fig. 2
VerticesAroundFacetBegEndPair AllVerticesAroundFacet( size_t iF ) const;
It is the iterator for traversing all vertices around the facet, starting from the vertex belonging to the edge defining the facet in a counterclockwise order (see Fig. 3).
Example of use:
for( const MbHalfedgeVertex & v : halfedge.AllVerticesAroundFacet( iFacet ) ) {
...
}
Fig. 3
EdgesAroundVertexBegEndPair AllEdgesAroundVertex( size_t iV ) const;
It is the iterator for traversing all edges (incoming and outgoing) adjacent to a given vertex, starting with the edge that defines the vertex (see Fig. 4). The traversal order is counterclockwise, alternating incoming and outgoing edges.
Example of use:
for( const MbHalfedgeEdge & ed : halfedge.AllEdgesAroundVertex( iVx ) ) {
...
}
Fig. 4
VerticesAroundVertexBegEndPair AllVerticesAroundVertex( size_t iV ) const;
It is the iterator for traversing all vertices adjacent to a given vertex (see Fig. 5). The order of traversal is counterclockwise, the first vertex is adjacent along the edge that defines the vertex.
Example of use:
for( const MbHalfedgeVertex & v : halfedge.AllVerticesAroundVertex( iVx ) ) {
...
}
Fig. 5
FacetsAroundVertexBegEndPair AllFacetsAroundVertex( size_t iV ) const;
It is the iterator for traversing all facets including the specified vertex (see Fig. 6). The traversal order is counterclockwise, the first facet includes the edge defining the vertex.
Example of use:
for( const MbHalfedgeFacet & f : halfedge.AllFacetsAroundVertex( iVx ) ) {
...
}
Fig. 6