Rhino C++ API  7.21
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
ON_MeshNgon Class Reference

#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_Mesh *mesh) const
 
unsigned int BoundaryEdgeCount (const ON_MeshFaceList &mesh_face_list) 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
 
unsigned int GetOuterBoundaryPoints (const class ON_3dPointListRef &mesh_vertex_list, bool bAppendStartPoint, ON_3dPoint *ngon_boundary_points) const
 
unsigned int GetOuterBoundaryPoints (const class ON_3dPointListRef &mesh_vertex_list, bool bAppendStartPoint, ON_SimpleArray< ON_3dPoint > &ngon_boundary_points) const
 
int Orientation (const ON_Mesh *mesh, bool bPermitHoles) const
 
int Orientation (const ON_MeshFaceList &mesh_face_list, bool bPermitHoles) const
 
unsigned int OuterBoundaryEdgeCount () const
 
void ReverseOuterBoundary ()
 
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 FindNgonBoundary (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 unsigned int FindNgonBoundary (const class ON_3dPointListRef &mesh_vertex_list, const class ON_MeshFaceList &mesh_face_list, ON_MeshVertexFaceMap *vertex_face_map, size_t ngon_fi_count, const unsigned int *ngon_fi, ON_SimpleArray< unsigned int > &ngon_vi)
 
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)
 
static unsigned int FindNgonOuterBoundary (const class ON_3dPointListRef &mesh_vertex_list, const class ON_MeshFaceList &mesh_face_list, ON_MeshVertexFaceMap *vertex_face_map, size_t ngon_fi_count, const unsigned int *ngon_fi, ON_SimpleArray< unsigned int > &ngon_vi)
 
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)
 
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)
 
static class ON_MeshNgon ** NgonListFromMeshFace (class ON_MeshNgonBuffer &ngon_buffer, unsigned int mesh_face_index, const unsigned int *fvi)
 
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)
 
static unsigned int TriangulateNgon (size_t boundary_vertex_count, const class ON_3dPoint *boundary_vertex_list, ON_SimpleArray< ON_MeshTriangle > &triangle_list)
 
static unsigned int TriangulateNgon (size_t point_index_count, size_t point_index_stride, const unsigned int *point_index_list, const class ON_3dPointListRef &point_list, ON_Plane projection_plane, double planar_tolerance, unsigned int triangle_index_type, ON_SimpleArray< ON_MeshTriangle > &triangle_list, ON_Plane *ngon_plane, ON_SimpleArray< ON_2dPoint > *points2d_list)
 

Public Attributes

unsigned int m_Fcount
 number of faces More...
 
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_Mesh mesh) const

Parameters: mesh - [in] mesh referenced by this n-gon. Returns: Total number of boundary edges, including interior edges.

◆ BoundaryEdgeCount() [2/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.

◆ 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

◆ FindNgonBoundary() [1/2]

static unsigned int ON_MeshNgon::FindNgonBoundary ( 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

Description: Get a list of vertices that form any boundary of a set of faces. This includes inner boundaries. 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.

◆ FindNgonBoundary() [2/2]

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

Description: Get a list of vertices that form any boundary of a set of faces. This includes inner boundaries. 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.

◆ FindNgonOuterBoundary() [1/2]

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

Description: 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.

◆ FindNgonOuterBoundary() [2/2]

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

Description: 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

Tools for finding a making n-gons

◆ GetBoundarySides()

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

Description: 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_3dPoint ngon_boundary_points 
) const

Description: 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.

◆ GetOuterBoundaryPoints() [2/2]

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

Description: 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.

◆ 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

Tools for validation output Description: 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

Description: 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

Description: 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

Description: 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_Mesh mesh,
bool  bPermitHoles 
) const

Pamameters: mesh_face_list - [in] ON_Mesh face list. bPermitHoles - [in] true if the ngon is permitted to have interior holes false otherwise. Description: 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_MeshFaceList mesh_face_list,
bool  bPermitHoles 
) const

Pamameters: mesh_face_list - [in] ON_Mesh face list. bPermitHoles - [in] true if the ngon is permitted to have interior holes false otherwise. Description: 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 ( )

Description: Reverse the order of the m_vi[] array.

◆ ToString()

ON_String ON_MeshNgon::ToString ( ) const

Tools for text output

◆ ToWideString()

ON_wString ON_MeshNgon::ToWideString ( ) const

◆ TriangulateNgon() [1/2]

static unsigned int ON_MeshNgon::TriangulateNgon ( size_t  boundary_vertex_count,
const class ON_3dPoint boundary_vertex_list,
ON_SimpleArray< ON_MeshTriangle > &  triangle_list 
)
static

Description: Trianglulate an ngon. Parameters: boundary_vertex_count - [in] boundary_vertex_list - [in] boundary_vertex_list[] should be an array of boundary_vertex_count points that forms a simple closed polygon. triangle_list - [out] Triangles are appended to this list Returns: Number of triangles appended to triangle_list[].

◆ TriangulateNgon() [2/2]

static unsigned int ON_MeshNgon::TriangulateNgon ( size_t  point_index_count,
size_t  point_index_stride,
const unsigned int *  point_index_list,
const class ON_3dPointListRef point_list,
ON_Plane  projection_plane,
double  planar_tolerance,
unsigned int  triangle_index_type,
ON_SimpleArray< ON_MeshTriangle > &  triangle_list,
ON_Plane ngon_plane,
ON_SimpleArray< ON_2dPoint > *  points2d_list 
)
static

Description: Trianglulate an ngon. Parameters: point_index_count - [in] point_index_stride - [in] point_index_list - [in] point_index_list[] is a list of indices into point_list[]. If point_index_count >= 3, 0 == point_index_stride, and null = point_index_list, then 3d points (point_list[0], point_list[1], ... point_list[point_index_count-1]) are used. Otherwise, for "i" from 0 to point_index_count-1, the 3d points point_list[point_index_list[i*point_index_stride] are used. point_list - [in] 3d point locations. projection_plane - [in] When in doubt, pass ON_Plane::UnsetPlane and a proper orientation of the plane ON_Plane::FromPointList( point_index_count, point_index_stride, point_index_list, point_list) will be used. This plane is used in the triangluation calculation to convert the 3d point list into a 2d point list. planar_tolerance - [in] When in doubt, pass ON_UNSET_VALUE. This tolerance is used to determine when the bondary points should be considered coplanar enough for convex polygon special case triangulation. triangle_index_type - [in] 0: The returned ON_MeshTriangle.m_vi[] values are in the in the range from 0 to point_index_count-1 and index the point_index_list[] array. 1: The returned ON_MeshTriangle.m_vi[] values are in the in the range from 0 to point_list.PointCount()-1 and index the point_list[] array. triangle_list - [out] Triangles are appended to this list ngon_plane - [out] If ngon_plane is not null, then the plane use to convert the 3d points into 2d points is returned here. If you pass in a projection_plane, the returned ngon_plane will be flipped if the outer boundary was oriented clockwise with respect to the input plane. points2d_list - [out] If points2d_list is not null, then the 2d points used to caclulate the triangulation are returned here. points2d_list[i] corresponds to the i-th boundary point. This information useful if you want to assign texture coordinates. Returns: Number of triangles appended to triangle_list[].

Member Data Documentation

◆ m_Fcount

unsigned int ON_MeshNgon::m_Fcount

number of faces

◆ m_fi

unsigned int* ON_MeshNgon::m_fi

N-gon face indices An array of m_Fcount indices into the mesh's m_F[] face array. Unset elements have the value ON_UNSET_UINT_INDEX. If the ngon in managed by an ON_NgonAllocator, then the memory for m_fi[] is also managed by that ON_NgonAllocator.

◆ m_Vcount

unsigned int ON_MeshNgon::m_Vcount

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

number of vertices and sides (the "n" in n-gon)

◆ m_vi

unsigned int* ON_MeshNgon::m_vi

N-gon vertex indices An array of m_Vcount indices into the mesh's m_V[] vertex array. Unset elements have the value ON_UNSET_UINT_INDEX. If the ngon in managed by an ON_NgonAllocator, then the memory for m_vi[] is also managed by that ON_NgonAllocator.