#include <opennurbs_mesh.h>

Public Member Functions

void AppendToString (class ON_String &s) const
 
void AppendToString (class ON_wString &s) const
 
unsigned int BoundaryEdgeCount (const ON_MeshFaceList &mesh_face_list) const
 
unsigned int BoundaryEdgeCount (const ON_Mesh *mesh) const
 
unsigned int Capacity () const
 
ON_SHA1_Hash ContentHash () const
 
ON__UINT32 CRC32 () const
 
void Dump (class ON_TextLog &text_log) const
 
unsigned int GetBoundarySides (const class ON_MeshFaceList &mesh_face_list, ON_SimpleArray< unsigned int > &ngon_boundary_sides) const
 Use the ngon m_fi[] array to get a list of ngon boundary sides. More...
 
unsigned int GetOuterBoundaryPoints (const class ON_3dPointListRef &mesh_vertex_list, bool bAppendStartPoint, ON_SimpleArray< ON_3dPoint > &ngon_boundary_points) const
 Use the ngon m_vi[] array to get a list of 3d points from mesh_vertex_list. More...
 
unsigned int GetOuterBoundaryPoints (const class ON_3dPointListRef &mesh_vertex_list, bool bAppendStartPoint, ON_3dPoint *ngon_boundary_points) const
 Use the ngon m_vi[] array to get a list of 3d points from mesh_vertex_list. More...
 
int Orientation (const ON_MeshFaceList &mesh_face_list, bool bPermitHoles) const
 Determine if the ngon's boundary orientation matches that of the set of faces it is made from. More...
 
int Orientation (const ON_Mesh *mesh, bool bPermitHoles) const
 Determine if the ngon's boundary orientation matches that of the set of faces it is made from. More...
 
unsigned int OuterBoundaryEdgeCount () const
 
void ReverseOuterBoundary ()
 Reverse the order of the m_vi[] array. More...
 
ON_String ToString () const
 
ON_wString ToWideString () const
 

Static Public Member Functions

static int Compare (const ON_MeshNgon *A, const ON_MeshNgon *B)
 
static unsigned int FindNgonOuterBoundary (const class ON_3dPointListRef &mesh_vertex_list, const class ON_MeshFaceList &mesh_face_list, const unsigned int *const *vertex_face_map, size_t ngon_fi_count, const unsigned int *ngon_fi, ON_SimpleArray< unsigned int > &ngon_vi)
 Get a list of vertices that form the boundary of a set of faces. More...
 
static unsigned int FindPlanarNgons (const class ON_3dPointListRef &vertex_list, const class ON_MeshFaceList &face_list, const unsigned int *const *vertex_face_map, double planar_tolerance, unsigned int minimum_ngon_vertex_count, unsigned int minimum_ngon_face_count, bool bAllowHoles, class ON_MeshNgonAllocator &NgonAllocator, ON_SimpleArray< unsigned int > &NgonMap, ON_SimpleArray< ON_MeshNgon *> &Ngons)
 
static unsigned int IsValid (const ON_MeshNgon *ngon, unsigned int ngon_index, ON_TextLog *text_log, unsigned int mesh_vertex_count, unsigned int mesh_face_count, const ON_MeshFace *mesh_F)
 Test ngon to see if the vertex and face references are valid and pass partial boundary validity checks, More...
 
static unsigned int IsValid (const ON_MeshNgon *ngon, unsigned int ngon_index, ON_TextLog *text_log, unsigned int mesh_vertex_count, unsigned int mesh_face_count, const ON_MeshFace *mesh_F, ON_SimpleArray< unsigned int > &workspace_buffer)
 
static class ON_MeshNgonNgonFromMeshFace (class ON_MeshNgonBuffer &ngon_buffer, unsigned int mesh_face_index, const unsigned int *fvi)
 Create an ngon pointer that contains a triangle (3-gon) or quad (4-gon) from a mesh face. This is handy when your code needs to handle both ngons and faces because it lets you convert a face to its ngon format and the rest of the code can work exclusively with ngons. More...
 
static class ON_MeshNgon ** NgonListFromMeshFace (class ON_MeshNgonBuffer &ngon_buffer, unsigned int mesh_face_index, const unsigned int *fvi)
 Create an array of a single ngon pointer that contains a triangle (3-gon) or quad (4-gon) from a mesh face. This is handy when your code needs to handle both ngons and faces because it lets you convert a face to its ngon format and the rest of the code can work exclusively with ngons. More...
 
static unsigned int NgonListFromMeshFaceOrNgonComponent (class ON_MeshNgonBuffer &ngon_buffer, ON_COMPONENT_INDEX ci, const class ON_Mesh *mesh, const class ON_MeshNgon *const *&ngon_list)
 If a component index identifies a face or ngon, Get an array Create an array of a single ngon pointer that contains a triangle (3-gon) or quad (4-gon) from a mesh face. This is handy when your code needs to handle both ngons and faces because it lets you convert a face to its ngon format and the rest of the code can work exclusively with ngons. More...
 

Public Attributes

unsigned int m_Fcount
 
unsigned int * m_fi
 
unsigned int m_Vcount
 Number of N-gon corners (N >= 3) More...
 
unsigned int * m_vi
 

Member Function Documentation

◆ AppendToString() [1/2]

void ON_MeshNgon::AppendToString ( class ON_String s) const

◆ AppendToString() [2/2]

void ON_MeshNgon::AppendToString ( class ON_wString s) const

◆ BoundaryEdgeCount() [1/2]

unsigned int ON_MeshNgon::BoundaryEdgeCount ( const ON_MeshFaceList mesh_face_list) const
Parameters
mesh_face_list[in] faces referenced by this n-gon.
Returns
Total number of boundary edges, including interior edges.

◆ BoundaryEdgeCount() [2/2]

unsigned int ON_MeshNgon::BoundaryEdgeCount ( const ON_Mesh mesh) const
Parameters
mesh[in] mesh referenced by this n-gon.
Returns
Total number of boundary edges, including interior edges.

◆ Capacity()

unsigned int ON_MeshNgon::Capacity ( ) const
Returns
0: This n-gon is not managed by an ON_MeshNgonAllocator. >=0: The maximum capcity (maximum m_Vcount+m_Fcount) for this N-gon

◆ Compare()

static int ON_MeshNgon::Compare ( const ON_MeshNgon A,
const ON_MeshNgon B 
)
static

◆ ContentHash()

ON_SHA1_Hash ON_MeshNgon::ContentHash ( ) const
Returns
A SHA-1 has of the vertex and face indices.

◆ CRC32()

ON__UINT32 ON_MeshNgon::CRC32 ( ) const
Returns
32-bit cyclic redundancy check that can be used as a hash code.

◆ Dump()

void ON_MeshNgon::Dump ( class ON_TextLog text_log) const

◆ FindNgonOuterBoundary()

static unsigned int ON_MeshNgon::FindNgonOuterBoundary ( const class ON_3dPointListRef mesh_vertex_list,
const class ON_MeshFaceList mesh_face_list,
const unsigned int *const *  vertex_face_map,
size_t  ngon_fi_count,
const unsigned int *  ngon_fi,
ON_SimpleArray< unsigned int > &  ngon_vi 
)
static

Get a list of vertices that form the boundary of a set of faces.

Parameters
mesh_vertex_list[in]
mesh_face_list[in]
vertex_face_map[in] null or a vertex map made from the information in mesh_vertex_list and mesh_face_list.
ngon_fi_count[in] length of ngon_fi[] array
ngon_fi[in] An array of length ngon_fi_count that contains the indices of the faces that form the ngon.
ngon_vi[out] An array of vertex indices that make the ngon boundary.
Returns
Number of vertices in the ngon outer boundary or 0 if the input is not valid.

◆ FindPlanarNgons()

static unsigned int ON_MeshNgon::FindPlanarNgons ( const class ON_3dPointListRef vertex_list,
const class ON_MeshFaceList face_list,
const unsigned int *const *  vertex_face_map,
double  planar_tolerance,
unsigned int  minimum_ngon_vertex_count,
unsigned int  minimum_ngon_face_count,
bool  bAllowHoles,
class ON_MeshNgonAllocator NgonAllocator,
ON_SimpleArray< unsigned int > &  NgonMap,
ON_SimpleArray< ON_MeshNgon *> &  Ngons 
)
static

◆ GetBoundarySides()

unsigned int ON_MeshNgon::GetBoundarySides ( const class ON_MeshFaceList mesh_face_list,
ON_SimpleArray< unsigned int > &  ngon_boundary_sides 
) const

Use the ngon m_fi[] array to get a list of ngon boundary sides.

Parameters
mesh_face_list[in]
ngon_boundary_sides[out] ngon_boundary_sides[i]/8 = ON_MeshNon.m_fi[] array index ngon_boundary_sides[i]%4 = side index side index 0 identifies the side that runs from the first face vertex to the second face vertex. ngon_boundary_sides[i]&4 != 0 means the face side is reversed when used as an ngon boundary segment.
Returns
Number of elements added to ngon_boundary_sides[] or 0 if invalid input is encountered.

◆ GetOuterBoundaryPoints() [1/2]

unsigned int ON_MeshNgon::GetOuterBoundaryPoints ( const class ON_3dPointListRef mesh_vertex_list,
bool  bAppendStartPoint,
ON_SimpleArray< ON_3dPoint > &  ngon_boundary_points 
) const

Use the ngon m_vi[] array to get a list of 3d points from mesh_vertex_list.

Parameters
mesh_vertex_list[in]
bAppendStartPoint[in] If true, the initial point in the boundary will be added as the first point of ngon_boundary_points[] and then added again as the last point of ngon_boundary_points[]. This is useful when you need a closed polyline.
ngon_boundary_points[out] An array of ngon->m_Vcount + (bAppendStartPoint ? 1 : 0) points.
Returns
Number of points added to ngon_boundary_points[] or 0 if invalid input is encountered.

◆ GetOuterBoundaryPoints() [2/2]

unsigned int ON_MeshNgon::GetOuterBoundaryPoints ( const class ON_3dPointListRef mesh_vertex_list,
bool  bAppendStartPoint,
ON_3dPoint ngon_boundary_points 
) const

Use the ngon m_vi[] array to get a list of 3d points from mesh_vertex_list.

Parameters
mesh_vertex_list[in]
bAppendStartPoint[in] If true, the initial point in the boundary will be added as the first point of ngon_boundary_points[] and then added again as the last point of ngon_boundary_points[]. This is useful when you need a closed polyline.
ngon_boundary_points[out] An array of ngon->m_Vcount + (bAppendStartPoint ? 1 : 0) points is returned in ngon_boundary_points[]. The caller must insure that ngon_boundary_points[] has room for this many elements.
Returns
Number of points added to ngon_boundary_points[] or 0 if invalid input is encountered.

◆ IsValid() [1/2]

static unsigned int ON_MeshNgon::IsValid ( const ON_MeshNgon ngon,
unsigned int  ngon_index,
ON_TextLog text_log,
unsigned int  mesh_vertex_count,
unsigned int  mesh_face_count,
const ON_MeshFace mesh_F 
)
static

Test ngon to see if the vertex and face references are valid and pass partial boundary validity checks,

Parameters
ngon[in] ngon to test
ngon_index[in] This index is used in messages sent to text_log
text_log[in] nullptr or a place to send information about problems.
mesh_vertex_count[in] Number of vertices in the mesh
mesh_face_count[in] Number of face in the mesh
mesh_F[in] nullptr of mesh faces - required for boundary checks
workspace_buffer[in] If you are passing in mesh_F and you are testing testing multple ngons, then consider providing a workspace_buffer that will be automatically reused for successive ngons.
Returns
0: ngon is not valid >0: number of boundary edges. If this number is > ngon->m_V_count, then the ngon has inner boundaries or duplicate vertices.

◆ IsValid() [2/2]

static unsigned int ON_MeshNgon::IsValid ( const ON_MeshNgon ngon,
unsigned int  ngon_index,
ON_TextLog text_log,
unsigned int  mesh_vertex_count,
unsigned int  mesh_face_count,
const ON_MeshFace mesh_F,
ON_SimpleArray< unsigned int > &  workspace_buffer 
)
static

◆ NgonFromMeshFace()

static class ON_MeshNgon* ON_MeshNgon::NgonFromMeshFace ( class ON_MeshNgonBuffer ngon_buffer,
unsigned int  mesh_face_index,
const unsigned int *  fvi 
)
static

Create an ngon pointer that contains a triangle (3-gon) or quad (4-gon) from a mesh face. This is handy when your code needs to handle both ngons and faces because it lets you convert a face to its ngon format and the rest of the code can work exclusively with ngons.

Parameters
buffer[in] an array with a capacity for at least 9 ON__UINT_PTR elements. The returned ngon information will be stored in this memory.
mesh_face_index[in]
fvi[in] mesh face vertex indices. If "f" is an ON_MeshFace, then pass (const unsigned int*)f.vi.
Returns
If the input is valid, the returned ngon pointer is is the face's triangle or quad. All returned information is in the buffer[]. null - invalid input.
See also
ON_Mesh::NgonFromComponentIndex()

◆ NgonListFromMeshFace()

static class ON_MeshNgon** ON_MeshNgon::NgonListFromMeshFace ( class ON_MeshNgonBuffer ngon_buffer,
unsigned int  mesh_face_index,
const unsigned int *  fvi 
)
static

Create an array of a single ngon pointer that contains a triangle (3-gon) or quad (4-gon) from a mesh face. This is handy when your code needs to handle both ngons and faces because it lets you convert a face to its ngon format and the rest of the code can work exclusively with ngons.

Parameters
ngon_buffer[in] memory used to create ngon classan array with a capacity for at least 10 ON__UINT_PTR elements.
mesh_face_index[in]
fvi[in] mesh face vertex indices. If "f" is an ON_MeshFace, then pass (const unsigned int*)f.vi.
Returns
If the input is valid, the returned pointer is an array of a single ngon that is the face's triangle or quad. All returned information is in the buffer[]. null - invalid input.

◆ NgonListFromMeshFaceOrNgonComponent()

static unsigned int ON_MeshNgon::NgonListFromMeshFaceOrNgonComponent ( class ON_MeshNgonBuffer ngon_buffer,
ON_COMPONENT_INDEX  ci,
const class ON_Mesh mesh,
const class ON_MeshNgon *const *&  ngon_list 
)
static

If a component index identifies a face or ngon, Get an array Create an array of a single ngon pointer that contains a triangle (3-gon) or quad (4-gon) from a mesh face. This is handy when your code needs to handle both ngons and faces because it lets you convert a face to its ngon format and the rest of the code can work exclusively with ngons.

Parameters
ngon_buffer[in] memory used to create ON_MeshNgon class
ci[in]
mesh[in]
ngon_list[out] An array of ngon pointers. Some pointers may be null.
Returns
Number of ngon pointers in ngon_list.

◆ Orientation() [1/2]

int ON_MeshNgon::Orientation ( const ON_MeshFaceList mesh_face_list,
bool  bPermitHoles 
) const

Determine if the ngon's boundary orientation matches that of the set of faces it is made from.

Returns
1: The ngon does not have holes, the ngon's faces are compatibly oriented, and the ngon's outer boundary orientation matches the faces' orientation. -1: The ngon does not have holes, the ngon's faces are compatibly oriented, and the ngon's outer boundary orientation is opposite the faces' orientation. 0: Otherwise. The ngon may be invalid, have holes, the ngon's faces may not be compatibly oriented, the ngons edges may not have a consistent orientation with respect to the faces, or some other issue.

◆ Orientation() [2/2]

int ON_MeshNgon::Orientation ( const ON_Mesh mesh,
bool  bPermitHoles 
) const

Determine if the ngon's boundary orientation matches that of the set of faces it is made from.

Returns
1: The ngon does not have holes, the ngon's faces are compatibly oriented, and the ngon's outer boundary orientation matches the faces' orientation. -1: The ngon does not have holes, the ngon's faces are compatibly oriented, and the ngon's outer boundary orientation is opposite the faces' orientation. 0: Otherwise. The ngon may be invalid, have holes, the ngon's faces may not be compatibly oriented, the ngons edges may not have a consistent orientation with respect to the faces, or some other issue.

◆ OuterBoundaryEdgeCount()

unsigned int ON_MeshNgon::OuterBoundaryEdgeCount ( ) const
Returns
Total number of outer boundary edges.

◆ ReverseOuterBoundary()

void ON_MeshNgon::ReverseOuterBoundary ( )

Reverse the order of the m_vi[] array.

◆ ToString()

ON_String ON_MeshNgon::ToString ( ) const

◆ ToWideString()

ON_wString ON_MeshNgon::ToWideString ( ) const

Member Data Documentation

◆ m_Fcount

unsigned int ON_MeshNgon::m_Fcount

◆ m_fi

unsigned int* ON_MeshNgon::m_fi

◆ m_Vcount

unsigned int ON_MeshNgon::m_Vcount

Number of N-gon corners (N >= 3)

◆ m_vi

unsigned int* ON_MeshNgon::m_vi