EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Attributes | List of all members
EBGeometry::DCEL::EdgeIteratorT< T > Class Template Reference

Half-edge iterator class for navigating the half edge mesh. More...

#include <EBGeometry_DCEL_Iterator.hpp>

Collaboration diagram for EBGeometry::DCEL::EdgeIteratorT< T >:
Collaboration graph
[legend]

Public Types

using Vertex = VertexT< T >
 Alias for DCEL vertex type.
 
using Edge = EdgeT< T >
 Alias for DCEL edge type.
 
using Face = FaceT< T >
 Alias for DCEL face type.
 
using Mesh = MeshT< T >
 Alias for DCEL mesh type.
 

Public Member Functions

 EdgeIteratorT ()=delete
 Default construction is not allowed. Use one of the full constructors.
 
 EdgeIteratorT (const Mesh &a_mesh, const Face &a_face) noexcept
 Constructor, taking a mesh and a face as argument. The iterator begins at the half-edge index contained in the face.
 
 EdgeIteratorT (const Mesh &a_mesh, const uint32_t a_startEdgeIndex) noexcept
 Constructor, taking a mesh and an arbitrary starting half-edge index directly (rather than a face's own half-edge). Useful for iterating a half-edge loop when only an edge index – not its face – is available.
 
 EdgeIteratorT (const EdgeIteratorT &a_other) noexcept
 Copy constructor.
 
 EdgeIteratorT (EdgeIteratorT &&a_other) noexcept=default
 Move constructor.
 
 ~EdgeIteratorT () noexcept=default
 Destructor.
 
EdgeIteratorT & operator= (const EdgeIteratorT &a_other) noexcept=default
 Copy assignment operator.
 
EdgeIteratorT & operator= (EdgeIteratorT &&a_other) noexcept=default
 Move assignment operator.
 
uint32_t operator() () const noexcept
 Operator returning the index of the current half-edge.
 
void reset () noexcept
 Reset function for the iterator. This resets the iterator so that it begins from the starting half-edge.
 
void operator++ () noexcept
 Incrementation operator, bringing the iterator to the next half-edge.
 
bool ok () const noexcept
 Function which checks if the iteration can be continued.
 

Protected Attributes

const Mesh * m_mesh = nullptr
 Owning mesh, used to resolve edge indices. Non-owning; must outlive the iterator.
 
bool m_fullLoop = false
 If true, a full loop has been made around the polygon face.
 
uint32_t m_startEdge = UINT32_MAX
 Starting half-edge index, or UINT32_MAX if unset.
 
uint32_t m_curEdge = UINT32_MAX
 Current half-edge index, or UINT32_MAX if unset.
 

Detailed Description

template<class T>
class EBGeometry::DCEL::EdgeIteratorT< T >

Half-edge iterator class for navigating the half edge mesh.

Class which makes it easier to iterate through DCEL edges.

Template Parameters
TFloating-point precision type.

Iterates the half-edge loop bounding a polygon face (or starting from an arbitrary half-edge index), following EdgeT::getNextEdgeIndex() until either the loop returns to its starting edge (a well-formed, closed face) or an unset next-edge index is reached (an incomplete/open half-edge chain). Resolves indices against the mesh passed at construction, so the iterator itself is a lightweight, short-lived (stack-only) helper – it must never be stored inside any DCEL object, a PODVector, or otherwise made to cross a host/device boundary as data (its m_mesh pointer is only ever meaningful within the address space it was constructed in). Typical usage:

for (EdgeIterator it(mesh, someFace); it.ok(); ++it) {
const uint32_t edgeIndex = it();
// ... use mesh.getEdge(edgeIndex) ...
}
Note
Every member resolves purely through m_mesh (itself resolved via EBGEOMETRY_HOST_DEVICE MeshT accessors) and plain uint32_t/bool values, so the entire public and protected interface is annotated EBGEOMETRY_HOST_DEVICE. Unlike every other DCEL class, this one is deliberately NOT std::is_trivially_copyable – see the copy constructor's doc comment – which is what stops it from being accepted into a PODVector in the first place.
Template Parameters
TFloating-point precision type.

Constructor & Destructor Documentation

◆ EdgeIteratorT() [1/4]

template<class T >
EBGeometry::DCEL::EdgeIteratorT< T >::EdgeIteratorT ( const Mesh &  a_mesh,
const Face &  a_face 
)
noexcept

Constructor, taking a mesh and a face as argument. The iterator begins at the half-edge index contained in the face.

Parameters
[in]a_meshOwning mesh, used to resolve edge indices.
[in]a_faceDCEL polygon face
Note
This constructor will iterate through the half-edges in the polygon face.

◆ EdgeIteratorT() [2/4]

template<class T >
EBGeometry::DCEL::EdgeIteratorT< T >::EdgeIteratorT ( const Mesh &  a_mesh,
const uint32_t  a_startEdgeIndex 
)
noexcept

Constructor, taking a mesh and an arbitrary starting half-edge index directly (rather than a face's own half-edge). Useful for iterating a half-edge loop when only an edge index – not its face – is available.

Parameters
[in]a_meshOwning mesh, used to resolve edge indices.
[in]a_startEdgeIndexStarting half-edge index. May be UINT32_MAX (ok() will then immediately return false).

◆ EdgeIteratorT() [3/4]

template<class T >
EBGeometry::DCEL::EdgeIteratorT< T >::EdgeIteratorT ( const EdgeIteratorT< T > &  a_other)
inlinenoexcept

Copy constructor.

Parameters
[in]a_otherOther iterator.

Deliberately user-provided rather than = default: unlike every other DCEL class, EdgeIteratorT holds a raw m_mesh pointer that is only ever meaningful within the address space it was constructed in (see the class-level note), so it must never be storable in a PODVector or mirrored to a device. A non-trivial copy constructor makes std::is_trivially_copyable_v false for this type, so PODVector<EdgeIteratorT<T>> (which asserts trivial copyability) fails to compile instead of silently carrying a dangling pointer across address spaces. This constructor is otherwise a plain memberwise copy and costs nothing extra once optimized.

◆ EdgeIteratorT() [4/4]

template<class T >
EBGeometry::DCEL::EdgeIteratorT< T >::EdgeIteratorT ( EdgeIteratorT< T > &&  a_other)
defaultnoexcept

Move constructor.

Parameters
[in,out]a_otherOther iterator.

Member Function Documentation

◆ ok()

template<class T >
bool EBGeometry::DCEL::EdgeIteratorT< T >::ok ( ) const
inlinenoexcept

Function which checks if the iteration can be continued.

Returns
True if the iterator has not completed a full loop and the current edge index is set.

◆ operator()()

template<class T >
uint32_t EBGeometry::DCEL::EdgeIteratorT< T >::operator() ( ) const
inlinenoexcept

Operator returning the index of the current half-edge.

Returns
Index of the current half-edge in the owning mesh's edge array.

◆ operator=() [1/2]

template<class T >
EdgeIteratorT & EBGeometry::DCEL::EdgeIteratorT< T >::operator= ( const EdgeIteratorT< T > &  a_other)
defaultnoexcept

Copy assignment operator.

Parameters
[in]a_otherOther iterator.
Returns
Reference to (*this).

◆ operator=() [2/2]

template<class T >
EdgeIteratorT & EBGeometry::DCEL::EdgeIteratorT< T >::operator= ( EdgeIteratorT< T > &&  a_other)
defaultnoexcept

Move assignment operator.

Parameters
[in,out]a_otherOther iterator.
Returns
Reference to (*this).

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