ON_MeshNgonIterator Class Reference

#include <opennurbs_mesh.h>

Public Member Functions

 ON_MeshNgonIterator ()=default
 
 ON_MeshNgonIterator (const ON_MeshNgonIterator &src)
 
 ON_MeshNgonIterator (const class ON_Mesh *mesh)
 
 ~ON_MeshNgonIterator ()=default
 
unsigned int Count () const
 
const class ON_MeshNgonCurrentNgon ()
 Get the ngon most recently returned by FirstNgon() or NextNgon(). More...
 
ON_COMPONENT_INDEX CurrentNgonComponentIndex () const
 
bool CurrentNgonIsMeshFace () const
 
bool CurrentNgonIsMeshNgon () const
 
const class ON_MeshNgonFirstNgon ()
 Returns the first ngon. More...
 
const ON_MeshMesh () const
 
const class ON_MeshNgonNextNgon ()
 Increments the iterator and returns the next ngon. More...
 
ON_MeshNgonIteratoroperator= (const ON_MeshNgonIterator &src)
 
void Reset ()
 Sets the state of the iterator to the initial state that exists after construction. This is useful if the iterator has been used the get one or more elements and then the referenced mesh is modified or code wants to begin iteration again a used a call to NextNgon() to return the first element. More...
 
void SetMesh (const class ON_Mesh *mesh, const unsigned int *meshfdex_to_meshngondex_map)
 

Static Public Attributes

static const ON_MeshNgonIterator EmptyMeshNgonIterator
 

Constructor & Destructor Documentation

◆ ON_MeshNgonIterator() [1/3]

ON_MeshNgonIterator::ON_MeshNgonIterator ( )
default

◆ ~ON_MeshNgonIterator()

ON_MeshNgonIterator::~ON_MeshNgonIterator ( )
default

◆ ON_MeshNgonIterator() [2/3]

ON_MeshNgonIterator::ON_MeshNgonIterator ( const ON_MeshNgonIterator src)

◆ ON_MeshNgonIterator() [3/3]

ON_MeshNgonIterator::ON_MeshNgonIterator ( const class ON_Mesh mesh)
Parameters
mesh[in] If the mesh has explicit ngons, then mesh->NgonMap() must return true;

Member Function Documentation

◆ Count()

unsigned int ON_MeshNgonIterator::Count ( ) const
Returns
Number of ngons that will be iterated over.

The count = explicit ngons + faces that are not in an ngon.

◆ CurrentNgon()

const class ON_MeshNgon* ON_MeshNgonIterator::CurrentNgon ( )

Get the ngon most recently returned by FirstNgon() or NextNgon().

Returns
Returns the ngon most recently returned by FirstNgon() or NextNgon().

If CurrentNgonIsMeshFace() is true after calling CurrentNgon(). the the returned ngon references a triangle or quad that is not part of an explicitly defined ngon in the mesh. If you need the information to persist after any subsequent calls to the iterator or after the destruction of the iterator, then you must make and manage a copy of the ngon.

◆ CurrentNgonComponentIndex()

ON_COMPONENT_INDEX ON_MeshNgonIterator::CurrentNgonComponentIndex ( ) const

◆ CurrentNgonIsMeshFace()

bool ON_MeshNgonIterator::CurrentNgonIsMeshFace ( ) const
Returns
If the current iterator ngon references an ON_MeshFace that is in m_mesh->m_F[] but is not explictly referenced by an ON_MeshNgon in ON_Mesh.m_Ngon[], then true is returned. In this case, the ngon's m_fi[] array has length 1 and contains the face's index, and the ngon's m_vi[] array is a copy of the faces's vi[] array. Otherwise false is returned.

◆ CurrentNgonIsMeshNgon()

bool ON_MeshNgonIterator::CurrentNgonIsMeshNgon ( ) const
Returns
If the current iterator ngon references an ON_MeshNgon that is in m_mesh->m_Ngon[], then true is returned. Otherwise false is returned.

◆ FirstNgon()

const class ON_MeshNgon* ON_MeshNgonIterator::FirstNgon ( )

Returns the first ngon.

Returns
The first ngon when iterating through the mesh triangles, quads and explicitly defined ngons.

If CurrentNgonIsMeshFace() is true after calling FirstNgon(). the the returned ngon references a triangle or quad that is not part of an explicitly defined ngon in the mesh. If you need the information to persist after any subsequent calls to the iterator or after the destruction of the iterator, then you must make and manage a copy of the ngon.

◆ Mesh()

const ON_Mesh* ON_MeshNgonIterator::Mesh ( ) const
Returns
The mesh being iterated.

◆ NextNgon()

const class ON_MeshNgon* ON_MeshNgonIterator::NextNgon ( )

Increments the iterator and returns the next ngon.

Returns
The next ngon when iterating through the mesh triangles, quads and explicitly defined ngons.

If CurrentNgonIsMeshFace() is true after calling NextNgon(). the the returned ngon references a triangle or quad that is not part of an explicitly defined ngon in the mesh. If you need the information to persist after any subsequent calls to the iterator or after the destruction of the iterator, then you must make and manage a copy of the ngon.

◆ operator=()

ON_MeshNgonIterator& ON_MeshNgonIterator::operator= ( const ON_MeshNgonIterator src)

◆ Reset()

void ON_MeshNgonIterator::Reset ( )

Sets the state of the iterator to the initial state that exists after construction. This is useful if the iterator has been used the get one or more elements and then the referenced mesh is modified or code wants to begin iteration again a used a call to NextNgon() to return the first element.

◆ SetMesh()

void ON_MeshNgonIterator::SetMesh ( const class ON_Mesh mesh,
const unsigned int *  meshfdex_to_meshngondex_map 
)
Parameters
mesh[in] If the mesh has explicit ngons,
meshfdex_to_meshngondex_map[in] It's generally best to pass the value of mesh->NgonMap(true). Expert users can specify a custom map if required.

Member Data Documentation

◆ EmptyMeshNgonIterator

const ON_MeshNgonIterator ON_MeshNgonIterator::EmptyMeshNgonIterator
static