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:

  1. 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 ) {
        ...
    }
}
../../../_images/P.2.2.1.png

Fig. 1

  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() );
}
  1. 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 ) ) {
    ...
}
../../../_images/P.2.2.2.png

Fig. 2

  1. 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 ) ) {
    ...
}
../../../_images/P.2.2.3.png

Fig. 3

  1. 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 ) ) {
    ...
}
../../../_images/P.2.2.4.png

Fig. 4

  1. 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 ) ) {
    ...
}
../../../_images/P.2.2.5.png

Fig. 5

  1. 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 ) ) {
    ...
}
../../../_images/P.2.2.6.png

Fig. 6