#include <opennurbs_mesh.h>

Inheritance diagram for ON_Mesh:
ON_Geometry ON_Object

Public Member Functions

 ON_Mesh ()
 
 ON_Mesh (int initial_face_array_capacity, int initial_vertex_array_capacity, bool has_vertex_normals, bool has_texture_coordinates)
 
 ON_Mesh (const ON_Mesh &)
 
 ~ON_Mesh ()
 
int AddNgon (unsigned int Vcount, const unsigned int *ngon_vi, unsigned int Fcount, const unsigned int *ngon_fi)
 Add a new ngon to the mesh. More...
 
unsigned int AddNgon (ON_MeshNgon *ngon)
 An expert user function that unconditionally appends the ngon pointer to ON_Mesh.m_Ngon[]. More...
 
unsigned int AddPlanarNgons (const unsigned int *const *vertex_face_map, double planar_tolerance, unsigned int minimum_ngon_vertex_count, unsigned int minimum_ngon_face_count, bool bAllowHoles)
 For each set of coplanar connected faces in the mesh that qualifies as an n-gon, an new ON_MeshNgon will be appended to the Ngons[] array. Faces belonging to existing ngons are ignored. More...
 
ON_MeshNgonAllocateNgon (unsigned int Vcount, unsigned int Fcount)
 An expert user function that allocates an ngon from heap memory managed by this ON_Mesh. More...
 
void Append (const ON_Mesh &)
 
void Append (int count, const ON_Mesh *const *meshes)
 Append a list of meshes. This function is much more efficient than making repeated calls to ON_Mesh::Append(const ON_Mesh&) when lots of meshes are being joined into a single large mesh. More...
 
unsigned int AppendDuplicateVertex (unsigned int vertex_index)
 Use this function to append a duplicate of an existing vertex. More...
 
const ON_TextureCoordinatesCachedTextureCoordinates (const ON_UUID &mapping_id) const
 
void Cleanup (bool bRemoveNgons, bool bRemoveDegenerateFaces, bool bCompact)
 Removes and unsets all possible cached information and then calls Compact(). More...
 
void Cleanup (bool bRemoveNgons)
 Calls the latest version of the detailed cleanup command passing the value for bRemoveNgons and setting all other parameters to true. More...
 
bool CollapseEdge (int topei)
 Replace a mesh edge with a vertex at its center and update adjacent faces as needed. More...
 
bool CombineCoincidentVertices (ON_3fVector, double)
 finds all coincident vertices and merges them if break angle is small enough More...
 
bool CombineIdenticalVertices (bool bIgnoreVertexNormals=false, bool bIgnoreTextureCoordinates=false)
 Combines identical vertices. More...
 
bool Compact ()
 Removes any unreferenced objects from arrays, reindexes as needed, and shrinks arrays to minimum required size. More...
 
bool ComputeFaceNormal (int)
 
bool ComputeFaceNormals ()
 
bool ComputeVertexNormals ()
 
unsigned int ConvertNonPlanarQuadsToTriangles (double planar_tolerance, double angle_tolerance_radians, unsigned int split_method)
 Splits non-planer quads into two triangles. More...
 
unsigned int ConvertNonPlanarQuadsToTriangles (double planar_tolerance, double angle_tolerance_radians, unsigned int split_method, bool bDeleteNgonsContainingSplitQuads)
 
bool ConvertQuadsToTriangles ()
 Splits all quads along the short diagonal. More...
 
bool ConvertTrianglesToQuads (double angle_tol_radians, double min_diagonal_length_ratio)
 Joins adjacent triangles into quads if the resulting quad is nice. More...
 
ON_MeshCopyComponents (const ON_COMPONENT_INDEX *ci_list, size_t ci_count, class ON_Mesh *destination_mesh) const
 Copy the subset of the mesh idenfied in the component list. More...
 
ON_MeshCopyComponents (const ON_SimpleArray< ON_COMPONENT_INDEX > &ci_list, class ON_Mesh *destination_mesh) const
 Copy the subset of the mesh idenfied in the component list. More...
 
bool CountQuads ()
 
const unsigned int * CreateNgonMap ()
 Expert user function to update n-gon map after the expert user does something to make the current one invalid. More...
 
const ON_MeshPartitionCreatePartition (int, int)
 
int CullClashingFaces (int what_to_cull)
 Cull clashing faces from the mesh. More...
 
unsigned int CullDegenerateFaces ()
 
int CullUnusedVertices ()
 
ON__UINT32 DataCRC (ON__UINT32 current_remainder) const override
 virtual ON_Object::DataCRC override More...
 
bool DeallocateNgon (ON_MeshNgon *ngon)
 An expert user function that deallocates an ngon that was created by AllocateNgon(). More...
 
bool DeleteComponent (ON_COMPONENT_INDEX ci)
 Calls the detailed version of DeleteComponents() with bool bIgnoreInvalidComponents = true; bool bRemoveDegenerateFaces = false; bool bRemoveUnusedVertices = true; bool bRemoveEmptyNgons = true; More...
 
bool DeleteComponents (const ON_COMPONENT_INDEX *ci_list, size_t ci_count, bool bIgnoreInvalidComponents, bool bRemoveDegenerateFaces, bool bRemoveUnusedVertices, bool bRemoveEmptyNgons)
 Delete the portions of the mesh identified in ci_list[]. More...
 
bool DeleteComponents (const ON_COMPONENT_INDEX *ci_list, size_t ci_count) override
 Calls the detailed version of DeleteComponents() with bool bIgnoreInvalidComponents = true; bool bRemoveDegenerateFaces = false; bool bRemoveUnusedVertices = true; bool bRemoveEmptyNgons = true; More...
 
bool DeleteComponents (const ON_SimpleArray< ON_COMPONENT_INDEX > &ci_list)
 Calls the detailed version of DeleteComponents() with bool bIgnoreInvalidComponents = true; bool bRemoveDegenerateFaces = false; bool bRemoveUnusedVertices = true; bool bRemoveEmptyNgons = true; More...
 
bool DeleteFace (int meshfi)
 Removes a face from a mesh and does not alter the geometry of the remaining mesh. More...
 
void DeleteMeshParameters ()
 
void Destroy ()
 
void DestroyDoublePrecisionVertices ()
 The function removes all double precision vertex information. More...
 
void DestroyHiddenVertexArray ()
 Destroys the m_H[] array and sets m_hidden_count=0. More...
 
void DestroyPartition ()
 
void DestroyRuntimeCache (bool bDelete=true) override
 virtual ON_Object::DestroyRuntimeCache override More...
 
void DestroyTopology ()
 
void DestroyTree (bool bDeleteTree=true)
 
int Dimension () const override
 ON_Geometry overrides. More...
 
ON_3dPointArrayDoublePrecisionVertices ()
 Implementation - mesh geometry. More...
 
const ON_3dPointArrayDoublePrecisionVertices () const
 
void Dump (ON_TextLog &) const override
 Creates a text dump of the object. More...
 
ON_MeshDuplicateFace (int face_index, ON_Mesh *mesh) const
 Create a mesh that is a single face of this mesh. More...
 
void EmergencyDestroy ()
 
bool EvaluateMeshGeometry (const ON_Surface &)
 
bool EvaluatePoint (const class ON_ObjRef &objref, ON_3dPoint &P) const override
 virtual ON_Geometry override More...
 
int FaceCount () const
 
bool FaceIsHidden (int meshvi) const
 Returns true if the mesh face is hidden. This is a runtime setting that is not saved in 3dm files. More...
 
unsigned int FaceUnsignedCount () const
 
void Flip ()
 
void FlipFaceNormals ()
 
void FlipFaceOrientation ()
 
void FlipNgonOrientation ()
 
void FlipVertexNormals ()
 
bool GetBBox (double *boxmin, double *boxmax, bool bGrowBox=false) const override
 virtual ON_Geometry GetBBox override More...
 
int GetClashingFacePairs (int max_pair_count, ON_SimpleArray< ON_2dex > &clashing_pairs) const
 Get a list of pairs of faces that clash. More...
 
int GetConnectedComponents (bool bUseVertexConnections, bool bTopologicalConnections, ON_SimpleArray< int > &facet_component_labels) const
 Calculates the components of a mesh and sets a label for each face in the facet_component_labels array. More...
 
int GetConnectedComponents (bool bUseVertexConnections, bool bTopologicalConnections, ON_SimpleArray< ON_Mesh *> *components) const
 Calculates the components of a mesh and sets a label for each face in the facet_component_labels array. More...
 
bool GetCurvatureStats (ON::curvature_style, ON_MeshCurvatureStats &) const
 
int GetMeshEdges (ON_SimpleArray< ON_2dex > &edges) const
 Appends a list of mesh edges to the edges[] array. More...
 
unsigned int GetMeshFaceSideList (const unsigned int *Vid, class ON_MeshFaceSide *&sides) const
 Get a list of the sides of every face. More...
 
unsigned int GetNgonBoundaryPoints (const ON_MeshNgon *ngon, bool bAppendStartPoint, ON_SimpleArray< ON_3dPoint > &ngon_boundary_points) const
 
unsigned int GetNgonBoundaryPoints (const ON_MeshNgon *ngon, bool bAppendStartPoint, ON_3dPoint *ngon_boundary_points) const
 
unsigned int GetNgonOuterBoundary (unsigned int ngon_fi_count, const unsigned int *ngon_fi, ON_SimpleArray< unsigned int > &ngon_vi) const
 
bool GetTightBoundingBox (class ON_BoundingBox &tight_bbox, bool bGrowBox=false, const class ON_Xform *xform=nullptr) const override
 virtual ON_Geometry GetTightBoundingBox override More...
 
bool GetTightBoundingBox (ON_BoundingBox &tight_bbox, bool bGrowBox, const ON_SimpleArray< ON_PlaneEquation > &clipping_planes, const ON_Xform *xform=nullptr) const
 
int GetVertexEdges (int vcount, const int *vertex_index, bool bNoDuplicates, ON_SimpleArray< ON_2dex > &edges) const
 Appends a list of mesh edges that begin or end at the specified vertices to the edges[] array. More...
 
unsigned int * GetVertexLocationIds (unsigned int first_vid, unsigned int *Vid, unsigned int *Vindex) const
 Assign a unique id to each vertex location. Coincident vertices get the same id. More...
 
bool HasCachedTextureCoordinates () const
 
bool HasDoublePrecisionVertices () const
 
bool HasFaceNormals () const
 
bool HasMeshTopology () const
 
bool HasNgons () const
 
bool HasPackedTextureRegion () const
 
bool HasPrincipalCurvatures () const
 
bool HasSinglePrecisionVertices () const
 
bool HasSurfaceParameters () const
 
bool HasSynchronizedDoubleAndSinglePrecisionVertices () const
 
bool HasTextureCoordinates () const
 
bool HasVertexColors () const
 
bool HasVertexNormals () const
 
const bool * HiddenVertexArray () const
 
int HiddenVertexCount () const
 
bool InsertNgon (unsigned int ngon_index, const ON_MeshNgon *ngon)
 Insert an n-gon in the ngon list. This is generally slow. Use AddNgon or ModifyNgon. More...
 
void InvalidateBoundingBoxes ()
 
void InvalidateCurvatureStats ()
 
void InvalidateTextureCoordinateBoundingBox ()
 
void InvalidateVertexBoundingBox ()
 
void InvalidateVertexNormalBoundingBox ()
 
int InvalidFaceCount () const
 
bool IsClosed () const
 
bool IsDeformable () const override
 virtual ON_Geometry::IsDeformable() override More...
 
bool IsEmpty () const
 
bool IsManifold () const
 
bool IsManifold (bool bTopologicalTest, bool *pbIsOriented=nullptr, bool *pbHasBoundary=nullptr) const
 Determine if the mesh is a manifold. More...
 
bool IsOriented () const
 
bool IsPointInside (ON_3dPoint test_point, double tolerance, bool bStrictlyInside) const
 Determine if a point is inside a solid brep. Paramters: test_point - [in] tolerance - [in] >= 0.0 3d distance tolerance used for ray-mesh intersection and determining strict inclusion. bStrictlyInside - [in] If bStrictlyInside is true, then test_point must be inside mesh by at least tolerance in order for this function to return true. If bStrictlyInside is false, then this function will return true if test_point is inside or the distance from test_point to a mesh face is <= tolerance. More...
 
bool IsSolid () const
 Test mesh to see if it is a solid. (A "solid" is a closed oriented manifold.) More...
 
bool IsSwappableEdge (int topei)
 Tests a mesh edge to see if it is valid as input to ON_Mesh::SwapMeshEdge. More...
 
bool IsValid (class ON_TextLog *text_log=nullptr) const override
 Tests an object to see if its data members are correctly initialized. More...
 
bool IsValidMeshComponentIndex (ON_COMPONENT_INDEX ci) const
 
bool IsValidNewNgonInformation (unsigned int Vcount, const unsigned int *ngon_vi, unsigned int Fcount, const unsigned int *ngon_fi) const
 
bool MakeDeformable () override
 virtual ON_Geometry::MakeDeformable() override More...
 
void MemoryRelocate () override
 Override of virtual ON_Object::MemoryRelocate. More...
 
class ON_MeshComponentRefMeshComponent (ON_COMPONENT_INDEX ci) const
 
class ON_MeshComponentRef MeshComponentRef (ON_COMPONENT_INDEX ci) const
 
const ON_MeshParametersMeshParameters () const
 
ON_MeshMeshPart (const ON_MeshPart &mesh_part, ON_Mesh *mesh) const
 Extract the portion of this mesh defined by mesh_part. More...
 
bool ModifyNgon (unsigned int ngon_index, unsigned int Vcount, const unsigned int *ngon_vi, unsigned int Fcount, const unsigned int *ngon_fi)
 
bool ModifyNgon (unsigned int ngon_index, const ON_MeshNgon *ngon)
 
const ON_MeshNgonNgon (unsigned int ngon_index) const
 
ON_BoundingBox NgonBoundaryBoundingBox (unsigned int ngon_index) const
 
ON_BoundingBox NgonBoundaryBoundingBox (const ON_MeshNgon *ngon) const
 
unsigned int NgonBoundaryEdgeCount (unsigned int ngon_index) const
 
ON_3dPoint NgonCenter (unsigned int ngon_index) const
 
ON_3dPoint NgonCenter (const ON_MeshNgon *ngon) const
 
int NgonCount () const
 Number of n-gons in this mesh. More...
 
const ON_MeshNgonNgonFromComponentIndex (class ON_MeshNgonBuffer &ngon_buffer, ON_COMPONENT_INDEX ci) const
 
unsigned int NgonIndexFromFaceIndex (unsigned int face_index) const
 
const unsigned int * NgonMap () const
 
const unsigned int * NgonMap (bool bCreateIfMissing)
 
const ON_MeshNgon *const * Ngons () const
 
unsigned int NgonUnsignedCount () const
 Number of n-gons in this mesh. More...
 
bool NormalizeTextureCoordinates ()
 
ON::object_type ObjectType () const override
 Useful for switch statements that need to differentiate between basic object types like points, curves, surfaces, and so on. More...
 
ON_Meshoperator= (const ON_Mesh &)
 
bool OrientNgons (bool bPermitHoles)
 If the mesh has ngons with ON_MeshNgon.Orientation() = -1, the reverse the ngon's boundary orientation. More...
 
const ON_MeshPartitionPartition () const
 
int QuadCount () const
 
bool Read (ON_BinaryArchive &) override
 Low level archive writing tool used by ON_BinaryArchive::ReadObject(). More...
 
void RemoveAllNgons ()
 Remove all entries from the ON_Mesh n-gon list. More...
 
void RemoveEmptyNgons ()
 Remove null and empty entries from the ON_Mesh n-gon list. More...
 
bool RemoveNgon (unsigned int ngon_index)
 Remove an n-gon. More...
 
bool RemoveNgonInteriorVertices (const unsigned int *const *vertex_face_map, unsigned int ngon_index0, unsigned int ngon_index1)
 For each ngon with index in the specified range that has interior vertices, remove the interior vertices and triangluate the ngon. More...
 
void RemoveNgonMap ()
 Removes any existing n-gon map. Does not remove other n-gon information. More...
 
unsigned int RemoveNgons (unsigned int ngon_index_count, const unsigned int *ngon_index_list)
 
bool ReserveVertexCapacity (size_t new_vertex_capacity)
 Increases the capactiy of arrays used to hold vertex information. More...
 
bool ReverseSurfaceParameters (int dir)
 
bool ReverseTextureCoordinates (int dir)
 Reverse one coordinate direction of the texture coordinates, within texture domain m_tex_domain More...
 
bool SeparateNgons (unsigned int **vertex_face_map, unsigned int ngon_index0, unsigned int ngon_index1)
 For each ngon with index in the specified range, duplicate vertices as needed so that the ngon does not share any vertices with faces that do not belong to the ngon. More...
 
const ON_TextureCoordinatesSetCachedTextureCoordinates (const class ON_TextureMapping &mapping, const class ON_Xform *mesh_xform=0, bool bLazy=true)
 
void SetClosed (int closed)
 Expert user function to set m_is_closed member. Setting this value correctly after a mesh is constructed can save time when IsClosed() is called. This function sets the private member variable m_is_closed. Paramters: closed - [in] 0: The mesh is not closed. There is at least one face with an edge that is geometrically distinct (as an unoriented line segment) from all other edges. 1: The mesh is closed. Every geometrically distict edge is used by two or more faces. More...
 
void SetMeshParameters (const ON_MeshParameters &)
 
void SetNgonCount (unsigned int ngon_count)
 Set the n-gon count. Null n-gons are be appended when ngon_count > current count. Existing n-gons are removed when ngon_count < current count. More...
 
bool SetNgonVertexNormals (unsigned int ngon_index0, unsigned int ngon_index1)
 For each ngon with index in the specified range, all vertices in the ngon will have their vertex normal set to the normal of the first face in the ngon. More...
 
bool SetQuad (int, int, int, int, int)
 
void SetSolidOrientation (int solid_orientation)
 Expert user function to set m_is_solid member. Setting this value correctly after a mesh is constructed can save time when IsSolid() is called. This function sets the private member variable m_is_solid. If solid is nonzero, it will set m_is_closed to 1. Paramters: solid - [in] 0: The mesh is not an oriented manifold solid mesh. Either the mesh is not closed, not manifold, or the faces are not oriented compatibly. 1: The mesh is an oriented manifold solid whose face normals point outwards. -1: The mesh is an oriented manifold solid whose face normals point inwards. More...
 
bool SetSurfaceParamtersFromTextureCoodinates ()
 If the mesh does not have surface evaulation parameters, has texture coordinates, and the surface parameters can be set in a way so the existing texture coordinates can be computed from the surface parameters, then this function sets the surface parameters. This is useful when meshes that have texture coordinates and do not have surface parameters want ot set the surface parameters in a way so that the texture mapping ON_TextureMapping::SurfaceParameterTextureMapping will restore the texture coordinates. More...
 
bool SetTextureCoord (int, double, double)
 
bool SetTextureCoordinates (const class ON_TextureMapping &mapping, const class ON_Xform *mesh_xform=0, bool bLazy=true)
 Use a texture mapping function to set the m_T[] values. More...
 
bool SetTriangle (int, int, int, int)
 
bool SetVertex (int, const ON_3dPoint &)
 creation More...
 
bool SetVertex (int, const ON_3fPoint &)
 
void SetVertexHiddenFlag (int meshvi, bool bHidden)
 Set the runtime vertex hidden flag. More...
 
bool SetVertexNormal (int, const ON_3dVector &)
 
bool SetVertexNormal (int, const ON_3fVector &)
 
unsigned int SizeOf () const override
 ON_Object overrides. More...
 
int SolidOrientation () const
 Determine orientation of a mesh. More...
 
bool SwapCoordinates (int, int) override
 Swaps object coordinate values with indices i and j. More...
 
bool SwapEdge (int topei)
 If the edge is shared by two triangular face, then the edge is "swapped". More...
 
const ON_MeshTopologyTopology () const
 
bool TopologyExists () const
 
bool Transform (const ON_Xform &) override
 Transforms the object. More...
 
bool TransposeSurfaceParameters ()
 
bool TransposeTextureCoordinates ()
 Transposes the texture coordinates Returns true - success More...
 
int TriangleCount () const
 
bool UnitizeFaceNormals ()
 
bool UnitizeVertexNormals ()
 
void UpdateDoublePrecisionVertices ()
 If you modify the values of the single precision vertices in m_V[], then you must call UpdateDoublePrecisionVertices(). More...
 
void UpdateSinglePrecisionVertices ()
 If you modify the values of double precision vertices, then you must call UpdateSinglePrecisonVertices(). More...
 
void V4V5_DestroyNgonList ()
 Destroy any existing N-gon list. More...
 
class ON_V4V5_MeshNgonList * V4V5_ModifyNgonList ()
 If an N-gon list exists, it is returned and can be modified. If no N-gon list exists, a new empty list is returned and it can be modified. More...
 
const class ON_V4V5_MeshNgonList * V4V5_NgonList () const
 If the mesh has an N-gon list, return a pointer to it. More...
 
ON_3dPoint Vertex (int vertex_index) const
 
int VertexCount () const
 query More...
 
bool VertexIsHidden (int meshvi) const
 Returns true if the mesh vertex is hidden. This is a runtime setting that is not saved in 3dm files. More...
 
unsigned int VertexUnsignedCount () const
 
bool Write (ON_BinaryArchive &) const override
 Low level archive writing tool used by ON_BinaryArchive::WriteObject(). More...
 
- Public Member Functions inherited from ON_Geometry
 ON_Geometry ()=default
 
 ON_Geometry (const ON_Geometry &)=default
 
 ~ON_Geometry ()=default
 
ON_BoundingBox BoundingBox () const
 Get object's 3d axis aligned bounding box. More...
 
virtual class ON_BrepBrepForm (class ON_Brep *brep=nullptr) const
 If possible, BrepForm() creates a brep form of the ON_Geometry. More...
 
virtual void ClearBoundingBox ()
 Some objects cache bounding box information. If you modify an object, then call ClearBoundingBox() to inform the object that any cached bounding boxes are invalid. More...
 
virtual ON_COMPONENT_INDEX ComponentIndex () const
 If this piece of geometry is a component in something larger, like an ON_BrepEdge in an ON_Brep, then this function returns the component index. More...
 
bool GetBoundingBox (ON_BoundingBox &bbox, bool bGrowBox=false) const
 Get object's 3d axis aligned bounding box or the union of the input box with the object's bounding box. More...
 
bool GetBoundingBox (ON_3dPoint &bbox_min, ON_3dPoint &bbox_max, bool bGrowBox=false) const
 Get corners of object's 3d axis aligned bounding box or the union of the input box with the object's bounding box. More...
 
virtual bool HasBrepForm () const
 Query an object to see if it has an ON_Brep form. Result: Returns true if the virtual ON_Geometry::BrepForm can compute an ON_Brep representation of this object. More...
 
ON_Geometryoperator= (const ON_Geometry &)=default
 
bool Rotate (double sin_angle, double cos_angle, const ON_3dVector &rotation_axis, const ON_3dPoint &rotation_center)
 Rotates the object about the specified axis. A positive rotation angle results in a counter-clockwise rotation about the axis (right hand rule). More...
 
bool Rotate (double rotation_angle, const ON_3dVector &rotation_axis, const ON_3dPoint &rotation_center)
 Rotates the object about the specified axis. A positive rotation angle results in a counter-clockwise rotation about the axis (right hand rule). More...
 
bool Scale (double scale_factor)
 Scales the object by the specified facotor. The scale is centered at the origin. More...
 
bool Translate (const ON_3dVector &translation_vector)
 Translates the object along the specified vector. More...
 
- Public Member Functions inherited from ON_Object
 ON_Object () ON_NOEXCEPT
 
 ON_Object (const ON_Object &)
 
virtual ~ON_Object ()
 
virtual ON_AggregateComponentStatus AggregateComponentStatus () const
 Call whenever a component status setting is modifed by directly changing it on a component in a way that will result in any saved information about the parent object's aggretate component status becoming invalid. More...
 
bool AttachUserData (class ON_UserData *pUserData)
 Attach user data to an object. More...
 
unsigned int ClearAllComponentStates () const
 Set all active level component states to ON_ComponentStatus::NoneSet. More...
 
virtual unsigned int ClearComponentStates (ON_ComponentStatus states_to_clear) const
 Clear the specified states on every component. More...
 
virtual unsigned int ClearComponentStates (ON_COMPONENT_INDEX component_index, ON_ComponentStatus states_to_clear) const
 Clear states on an individual component. More...
 
unsigned int CopyUserData (const ON_Object &source_object, ON_UUID source_userdata_item_id, ON_Object::UserDataConflictResolution userdata_conflict_resolution)
 Expert user tool that copies user data items with positive values of ON_UserData.m_userdata_copycount from source_object to "this. More...
 
void CopyUserData (const ON_Object &source_object)
 Calls CopyUserData(source_object,ON_Object::UserDataConflictResolution::source_object). More...
 
bool DetachUserData (class ON_UserData *pUserData)
 Remove user data from an object. More...
 
void EmergencyDestroy ()
 Sets m_user_data_list = 0. More...
 
class ON_UserDataFirstUserData () const
 User data is stored as a linked list of ON_UserData classes. FirstUserData gets the first item in the linked list. This is the most recent item attached using AttachUserData(). Remark: To iterate through all the user data on an object, call FirstUserData() and then use ON_UserData::Next() to traverse the list. More...
 
virtual unsigned int GetComponentsWithSetStates (ON_ComponentStatus states_filter, bool bAllEqualStates, ON_SimpleArray< ON_COMPONENT_INDEX > &components) const
 
class ON_UserDataGetUserData (const ON_UUID &userdata_uuid) const
 Get a pointer to user data. More...
 
bool GetUserString (const wchar_t *key, ON_wString &string_value) const
 Get user string from the object. More...
 
int GetUserStringKeys (ON_ClassArray< ON_wString > &user_string_keys) const
 Get a list of all user string keys on the object. More...
 
int GetUserStrings (ON_ClassArray< ON_UserString > &user_strings) const
 Get a list of all user strings on the object. More...
 
bool IsKindOf (const ON_ClassId *pClassId) const
 Low level tool to test if an object is derived from a specified class. More...
 
virtual void MarkAggregateComponentStatusAsNotCurrent () const
 Call whenever a component status setting is modifed by directly changing it on a component in a way that will result in any saved information about the parent object's aggretate component status becoming invalid. More...
 
virtual ON_UUID ModelObjectId () const
 All objects in an opennurbs model have an id ( ON_Layer.m_layer_id, ON_Font.m_font_id, ON_Material.m_material_id, ON_3dmObjectAttributes.m_uuid ). More...
 
unsigned int MoveUserData (ON_Object &source_object, ON_UUID source_userdata_item_id, ON_Object::UserDataConflictResolution userdata_conflict_resolution, bool bDeleteAllSourceItems)
 Expert user tool that moves user data items from source_object to "this. More...
 
void MoveUserData (ON_Object &source_object)
 Calls MoveUserData(source_object,ON_Object::UserDataConflictResolution::source_object,true). More...
 
ON_Objectoperator= (const ON_Object &)
 
void PurgeUserData ()
 PurgeUserData() removes all user data from object. More...
 
virtual unsigned int SetComponentStates (ON_COMPONENT_INDEX component_index, ON_ComponentStatus states_to_set) const
 Set states on an individual component. More...
 
virtual unsigned int SetComponentStatus (ON_COMPONENT_INDEX component_index, ON_ComponentStatus status_to_copy) const
 Copy status settings to an individual component. More...
 
bool SetUserString (const wchar_t *key, const wchar_t *string_value)
 Attach a user string to the object. This information will perisist through copy construction, operator=, and file IO. More...
 
int SetUserStrings (int count, const ON_UserString *user_strings, bool bReplace)
 Append entries to the user string list More...
 
void TransformUserData (const class ON_Xform &xform)
 Objects derived from ON_Geometry must call TransformUserData() in their Transform() member function. More...
 
virtual bool UpdateReferencedComponents (const class ON_ComponentManifest &source_manifest, const class ON_ComponentManifest &destination_manifest, const class ON_ManifestMap &manifest_map)
 Uses the destination_manifest to update references to other components. This is typically done when a component's references came from a "source" context and are being updated to the "destination" context. For example, inserting one model into another when index, id, and name conflicts need to be resolved at the time of insertion. More...
 
int UserStringCount () const
 

Public Attributes

ON_SimpleArray< ON_Colorm_C
 
ON_MappingTag m_Ctag
 Implementation - false color. More...
 
ON_3dPointArray m_dV
 m_dV[] double precision vertices. m_V[] single precision vertices. More...
 
ON_SimpleArray< ON_MeshFacem_F
 m_F[] facets (triangles or quads) More...
 
ON_3fVectorArray m_FN
 
ON_SimpleArray< bool > m_H
 Implementation - runtime vertex visibility - not saved in 3dm files. More...
 
int m_hidden_count
 
ON_SimpleArray< ON_SurfaceCurvaturem_K
 Implementation - curvature. More...
 
ON_3fVectorArray m_N
 
ON_SimpleArray< ON_MeshNgon * > m_Ngon
 
ON_MeshNgonAllocator m_NgonAllocator
 
ON_SimpleArray< unsigned int > m_NgonMap
 
ON_Interval m_packed_tex_domain [2]
 
bool m_packed_tex_rotate
 
const ON_Objectm_parent
 Implementation - runtime UI information. More...
 
ON_2dPointArray m_S
 
ON_Interval m_srf_domain [2]
 
double m_srf_scale [2]
 
ON_2fPointArray m_T
 
ON_ClassArray< ON_TextureCoordinatesm_TC
 
ON_MappingTag m_Ttag
 
ON_3fPointArray m_V
 

Protected Attributes

int m_invalid_count
 
ON_MeshCurvatureStatsm_kstat [4]
 
ON_MeshParametersm_mesh_parameters
 
float m_nbox [2][3]
 
ON_MeshPartitionm_partition
 sub-mesh information rendering large meshes More...
 
int m_quad_count
 
float m_tbox [2][2]
 
ON_MeshTopology m_top
 Implementation - mesh topology. More...
 
int m_triangle_count
 

Additional Inherited Members

- Public Types inherited from ON_Object
enum  UserDataConflictResolution : unsigned char {
  UserDataConflictResolution::destination_object = 0, UserDataConflictResolution::source_object = 1, UserDataConflictResolution::source_copycount_gt = 2, UserDataConflictResolution::source_copycount_ge = 3,
  UserDataConflictResolution::destination_copycount_gt = 4, UserDataConflictResolution::destination_copycount_ge = 5, UserDataConflictResolution::delete_item = 6
}
 When a userdata item is copied or moved from a source object to a destination object, the ON_Object::UserDataConflictResolution enum values specify how conficts are resolved. Remark: A userdata item "conflict" occurs when both the destination and source object have a user data item with the same value of ON_UserData::m_userdata_uuid. More...
 
- Static Public Attributes inherited from ON_Geometry
static const ON_Geometry Unset
 

Constructor & Destructor Documentation

◆ ON_Mesh() [1/3]

ON_Mesh::ON_Mesh ( )

◆ ON_Mesh() [2/3]

ON_Mesh::ON_Mesh ( int  initial_face_array_capacity,
int  initial_vertex_array_capacity,
bool  has_vertex_normals,
bool  has_texture_coordinates 
)

◆ ON_Mesh() [3/3]

ON_Mesh::ON_Mesh ( const ON_Mesh )

◆ ~ON_Mesh()

ON_Mesh::~ON_Mesh ( )

Member Function Documentation

◆ AddNgon() [1/2]

int ON_Mesh::AddNgon ( unsigned int  Vcount,
const unsigned int *  ngon_vi,
unsigned int  Fcount,
const unsigned int *  ngon_fi 
)

Add a new ngon to the mesh.

Parameters
Vcountnumber of vertices and number of sides in the n-gon ngon_vi[] - in An array of N distinct ON_Mesh.m_V[] vertex indices
Fcount[in] Number of face that make up the ngon. ngon_fi[] An array of N distinct ON_Mesh.m_F[] face indices The outer boundary of this group of faces should be the list of vertices passes as ngon_vi[]
Returns
index of the new n-gon. -1: If input information is not valid.

◆ AddNgon() [2/2]

unsigned int ON_Mesh::AddNgon ( ON_MeshNgon ngon)

An expert user function that unconditionally appends the ngon pointer to ON_Mesh.m_Ngon[].

Parameters
ngon[in]
Returns
ON_UNSET_UINT_INDEX: invalid input < ON_UNSET_UINT_INDEX: index of the new n-gon.

◆ AddPlanarNgons()

unsigned int ON_Mesh::AddPlanarNgons ( const unsigned int *const *  vertex_face_map,
double  planar_tolerance,
unsigned int  minimum_ngon_vertex_count,
unsigned int  minimum_ngon_face_count,
bool  bAllowHoles 
)

For each set of coplanar connected faces in the mesh that qualifies as an n-gon, an new ON_MeshNgon will be appended to the Ngons[] array. Faces belonging to existing ngons are ignored.

Parameters
vertex_face_map[in]
  • Pass null if you don't have one.
  • See ON_MeshVertexFaceMap for details about making one. The only reason to pass one in is because you need it for other reasons or you already have one.
planar_tolerance[in] For faces to be coplanar, all the points in the
ngon must be withing planar_tolerance of the plane defined by the first face in the n-gon.
minimum_ngon_vertex_count[in]
ngons must have at least this many sides in order to be added.
minimum_ngon_face_count[in]
ngons must have at least this many faces in order to be added.
bAllowHoles[in] If true, then the added ngons are permitted to have holes.
bSeparateNgons[in] If true, any face belonging to a new ngon, will not share vertices with a face that does not belong to that ngon and the vertex normals for all vertices in an ngon will be set to the plane's normal.
bSetNgonVertexNormals[in] If bSeparateNgons and bSetNgonVertexNormals are both true, then all vertex normals vertices in a new ngon will be set to the ngon's plane normal.
bRemoveNgonInteriorPoints[in] If true, the new ngons will not have interior vertices. This will result in the ngon being retriangluated when connected coplanar faces
Returns
The number of new n-gons appended to m_Ngons[]

◆ AllocateNgon()

ON_MeshNgon* ON_Mesh::AllocateNgon ( unsigned int  Vcount,
unsigned int  Fcount 
)

An expert user function that allocates an ngon from heap memory managed by this ON_Mesh.

Parameters
N[in] (>= 3)
Fcount[in]
Returns
A pointer to an uninitialized ngon. Use the ON_Mesh::AddNgon(ngon) to add this ngon to the mesh or use DeallocateNgon(ngon) to deallocate the ngon.

◆ Append() [1/2]

void ON_Mesh::Append ( const ON_Mesh )

◆ Append() [2/2]

void ON_Mesh::Append ( int  count,
const ON_Mesh *const *  meshes 
)

Append a list of meshes. This function is much more efficient than making repeated calls to ON_Mesh::Append(const ON_Mesh&) when lots of meshes are being joined into a single large mesh.

Parameters
count[in] length of meshes[] array.
meshes[in] array of meshes to append.

◆ AppendDuplicateVertex()

unsigned int ON_Mesh::AppendDuplicateVertex ( unsigned int  vertex_index)

Use this function to append a duplicate of an existing vertex.

Parameters
vertex_index[in] index of the existing vertex
Returns
If vertex_index is valid, the index of the duplicate is returned. Otherwise, ON_UNSET_UINT_INDEX is returned.

This function duplicates all information associated with the input vertex and is a good way to insure that optional vertex information like color, texture, surface parameters, curvatures, vertex normals, and so on get duplicated as well.

◆ CachedTextureCoordinates()

const ON_TextureCoordinates* ON_Mesh::CachedTextureCoordinates ( const ON_UUID mapping_id) const

◆ Cleanup() [1/2]

void ON_Mesh::Cleanup ( bool  bRemoveNgons,
bool  bRemoveDegenerateFaces,
bool  bCompact 
)

Removes and unsets all possible cached information and then calls Compact().

Parameters
bRemoveNgons[in] If true, all n-gon information is removed.
bRemoveDegenerateFaces[in] If true, CullDegenerateFaces() is used to remove degenerate faces.
bCompact[in] If true, Compact() is called after removing cached information.

◆ Cleanup() [2/2]

void ON_Mesh::Cleanup ( bool  bRemoveNgons)

Calls the latest version of the detailed cleanup command passing the value for bRemoveNgons and setting all other parameters to true.

Parameters
bRemoveNgons[in] If true, all n-gon information is removed.

◆ CollapseEdge()

bool ON_Mesh::CollapseEdge ( int  topei)

Replace a mesh edge with a vertex at its center and update adjacent faces as needed.

Parameters
topei[in] index of edge in MeshTopology().m_tope[] array
Returns
true if successful.

◆ CombineCoincidentVertices()

bool ON_Mesh::CombineCoincidentVertices ( ON_3fVector  ,
double   
)

finds all coincident vertices and merges them if break angle is small enough

◆ CombineIdenticalVertices()

bool ON_Mesh::CombineIdenticalVertices ( bool  bIgnoreVertexNormals = false,
bool  bIgnoreTextureCoordinates = false 
)

Combines identical vertices.

Parameters
bIgnoreVertexNormals[in] If true, then vertex normals are ignored when comparing vertices.
bIgnoreTextureCoordinates[in] If true, then vertex texture coordinates, colors, and principal curvatures are ignored when comparing vertices.
Returns
True if the mesh is changed, in which case the returned mesh will have fewer vertices than the input mesh.

◆ Compact()

bool ON_Mesh::Compact ( )

Removes any unreferenced objects from arrays, reindexes as needed, and shrinks arrays to minimum required size.

◆ ComputeFaceNormal()

bool ON_Mesh::ComputeFaceNormal ( int  )

◆ ComputeFaceNormals()

bool ON_Mesh::ComputeFaceNormals ( )

◆ ComputeVertexNormals()

bool ON_Mesh::ComputeVertexNormals ( )

◆ ConvertNonPlanarQuadsToTriangles() [1/2]

unsigned int ON_Mesh::ConvertNonPlanarQuadsToTriangles ( double  planar_tolerance,
double  angle_tolerance_radians,
unsigned int  split_method 
)

Splits non-planer quads into two triangles.

Parameters
planar_tolerance[in] If planar_tolerance >= 0, then a quad is split if its vertices are not coplaner.

If both planar_tolerance = ON_UNSET_VALUE and angle_tolerance_radians >= 0.0, then the planarity test is skipped.

If both planar_tolerance = ON_UNSET_VALUE and angle_tolerance_radians = ON_UNSET_VALUE, then all quads are split.

Parameters
angle_tolerance_radians[in] If angle_tolerance_radians >= 0.0, then a quad is split if the angle between opposite corner normals is > angle_tolerance_radians. The corner normal is the normal to the triangle formed by two adjacent edges and the diagonal connecting their endpoints. A quad has for corner normals.

If both angle_tolerance_radians = ON_UNSET_VALUE and planar_tolerance >= 0.0, then the corner normal angle test is skipped.

If both planar_tolerance = ON_UNSET_VALUE and angle_tolerance_radians = ON_UNSET_VALUE, then all quads are split.

Parameters
split_method[in] 0 default Currently divides along the short diagonal. This may be changed as better methods are found or preferences change. By passing zero, you let the developers of this code decide what's best for you over time. 1 divide along the short diagonal 2 divide along the long diagonal 3 minimize resulting area 4 maximize resulting area 5 minimize angle between triangle normals 6 maximize angle between triangle normals
bDeleteNgonsContainingSplitQuads[in] If true, ngons that contain a split quad are deleted.
Returns
Number of quads that were converted to triangles.

◆ ConvertNonPlanarQuadsToTriangles() [2/2]

unsigned int ON_Mesh::ConvertNonPlanarQuadsToTriangles ( double  planar_tolerance,
double  angle_tolerance_radians,
unsigned int  split_method,
bool  bDeleteNgonsContainingSplitQuads 
)

◆ ConvertQuadsToTriangles()

bool ON_Mesh::ConvertQuadsToTriangles ( )

Splits all quads along the short diagonal.

◆ ConvertTrianglesToQuads()

bool ON_Mesh::ConvertTrianglesToQuads ( double  angle_tol_radians,
double  min_diagonal_length_ratio 
)

Joins adjacent triangles into quads if the resulting quad is nice.

Parameters
angle_tol_radians[in] Used to compare adjacent triangles' face normals. For two triangles to be considered, the angle between their face normals has to be <= angle_tol_radians. When in doubt use ON_PI/90.0 (2 degrees).
min_diagonal_length_ratioin For two triangles to be considered the ratio of the resulting quad's diagonals (length of the shortest diagonal)/(length of longest diagonal). has to be >= min_diagonal_length_ratio. When in doubt us .875.

◆ CopyComponents() [1/2]

ON_Mesh* ON_Mesh::CopyComponents ( const ON_COMPONENT_INDEX *  ci_list,
size_t  ci_count,
class ON_Mesh destination_mesh 
) const

Copy the subset of the mesh idenfied in the component list.

Parameters
ci_list[in]
ci_count[in] ci_list[] is an array of ci_count components that identify the parts of the mesh to copy. If a face or ngon is specified, then any vertices or faces needed for a valid copy are automatically copied as well.
destination_mesh[in] If null, a new mesh is allocated for the copy. If not null, the copy is put in this mesh. Return:
nullinvalid input - no copy created not null - a pointer to the copy.

◆ CopyComponents() [2/2]

ON_Mesh* ON_Mesh::CopyComponents ( const ON_SimpleArray< ON_COMPONENT_INDEX > &  ci_list,
class ON_Mesh destination_mesh 
) const

Copy the subset of the mesh idenfied in the component list.

Parameters
ci_list[in] ci_list[] is an array of ci_count components that identify the parts of the mesh to copy. If a face or ngon is specified, then any vertices or faces needed for a valid copy are automatically copied as well.
destination_mesh[in] If null, a new mesh is allocated for the copy. If not null, the copy is put in this mesh. Return:
nullinvalid input - no copy created not null - a pointer to the copy.

◆ CountQuads()

bool ON_Mesh::CountQuads ( )

◆ CreateNgonMap()

const unsigned int* ON_Mesh::CreateNgonMap ( )

Expert user function to update n-gon map after the expert user does something to make the current one invalid.

Returns
null: The mesh does not have ngon-information. an array of length m_F.Count() ngon_map[]
  • If ngon_map[fi] >= 0, then ON_MeshFace.m_F[fi] belongs to ON_Mesh.Ngon(ngon_map[fi]).
  • Otherwise, ngon_map[fi] = -1.

◆ CreatePartition()

const ON_MeshPartition* ON_Mesh::CreatePartition ( int  ,
int   
)

◆ CullClashingFaces()

int ON_Mesh::CullClashingFaces ( int  what_to_cull)

Cull clashing faces from the mesh.

Parameters
what_to_cull[in] 0: when a pair of faces clash, cull both faces 1: when a pair of faces clash, leave the face with the longest edge. 2: when a pair of faces clash, cull the face with the longest edge. 3: when a pair of faces clash, leave the face with the largest area. 4: when a pair of faces clash, cull the face with the largest area.
Returns
Number of faces culled from the mesh.

If a large face clashes with many small faces, the large face and one small face will be removed. When a degenerate face is encountered, it is also culled.

◆ CullDegenerateFaces()

unsigned int ON_Mesh::CullDegenerateFaces ( )

◆ CullUnusedVertices()

int ON_Mesh::CullUnusedVertices ( )

◆ DataCRC()

ON__UINT32 ON_Mesh::DataCRC ( ON__UINT32  current_remainder) const
overridevirtual

virtual ON_Object::DataCRC override

Reimplemented from ON_Object.

◆ DeallocateNgon()

bool ON_Mesh::DeallocateNgon ( ON_MeshNgon ngon)

An expert user function that deallocates an ngon that was created by AllocateNgon().

Parameters
ngon[in]

◆ DeleteComponent()

bool ON_Mesh::DeleteComponent ( ON_COMPONENT_INDEX  ci)

Calls the detailed version of DeleteComponents() with bool bIgnoreInvalidComponents = true; bool bRemoveDegenerateFaces = false; bool bRemoveUnusedVertices = true; bool bRemoveEmptyNgons = true;

◆ DeleteComponents() [1/3]

bool ON_Mesh::DeleteComponents ( const ON_COMPONENT_INDEX *  ci_list,
size_t  ci_count,
bool  bIgnoreInvalidComponents,
bool  bRemoveDegenerateFaces,
bool  bRemoveUnusedVertices,
bool  bRemoveEmptyNgons 
)

Delete the portions of the mesh identified in ci_list[].

Parameters
ci_list[in] List of components to delete.
ci_list_count[in] Number of elements in the ci_list[] array. Can be zero if you are using this function to remove unused vertices or empty ngons.
bIgnoreInvalidComponents[in] If true, invalid elements in ci_list[] are ignored. If false and ci_list[] contains an invalid element, then no changes are made and false is returned.
bRemoveDegenerateFaces[in] If true, remove degenerate faces.
bCullUnusedVertices[in] Remove vertices that are not referenced by a face. Pass true unless you have a good reason for keeping unreferenced vertices.
bRemoveEmptyNgons[in] Remove ngons that are empty. Pass true unless you have a good reason for keeping empty ngons.
Returns
True: succesful False: failure - no changes.

◆ DeleteComponents() [2/3]

bool ON_Mesh::DeleteComponents ( const ON_COMPONENT_INDEX *  ci_list,
size_t  ci_count 
)
overridevirtual

Calls the detailed version of DeleteComponents() with bool bIgnoreInvalidComponents = true; bool bRemoveDegenerateFaces = false; bool bRemoveUnusedVertices = true; bool bRemoveEmptyNgons = true;

Reimplemented from ON_Object.

◆ DeleteComponents() [3/3]

bool ON_Mesh::DeleteComponents ( const ON_SimpleArray< ON_COMPONENT_INDEX > &  ci_list)

Calls the detailed version of DeleteComponents() with bool bIgnoreInvalidComponents = true; bool bRemoveDegenerateFaces = false; bool bRemoveUnusedVertices = true; bool bRemoveEmptyNgons = true;

◆ DeleteFace()

bool ON_Mesh::DeleteFace ( int  meshfi)

Removes a face from a mesh and does not alter the geometry of the remaining mesh.

Parameters
meshfi[in] index of face in ON_Mesh.m_F[] array
Returns
true if successful

This function calls DestroyTopology() and DestroyPartition(). The caller is responsible for calling Compact() if that step is required.

◆ DeleteMeshParameters()

void ON_Mesh::DeleteMeshParameters ( )

◆ Destroy()

void ON_Mesh::Destroy ( )

◆ DestroyDoublePrecisionVertices()

void ON_Mesh::DestroyDoublePrecisionVertices ( )

The function removes all double precision vertex information.

◆ DestroyHiddenVertexArray()

void ON_Mesh::DestroyHiddenVertexArray ( )

Destroys the m_H[] array and sets m_hidden_count=0.

◆ DestroyPartition()

void ON_Mesh::DestroyPartition ( )

◆ DestroyRuntimeCache()

void ON_Mesh::DestroyRuntimeCache ( bool  bDelete = true)
overridevirtual

virtual ON_Object::DestroyRuntimeCache override

Reimplemented from ON_Object.

◆ DestroyTopology()

void ON_Mesh::DestroyTopology ( )

◆ DestroyTree()

void ON_Mesh::DestroyTree ( bool  bDeleteTree = true)

◆ Dimension()

int ON_Mesh::Dimension ( ) const
overridevirtual

ON_Geometry overrides.

Reimplemented from ON_Geometry.

◆ DoublePrecisionVertices() [1/2]

ON_3dPointArray& ON_Mesh::DoublePrecisionVertices ( )

Implementation - mesh geometry.

Get double precision vertices. If they do not exist, they will be created and match the existing single precision vertices.

Returns
Array of double precision vertices. If you modify the values in this array, you must make the same modifications to the single precision vertices, or call UpdateSinglePrecisonVertices().

Avoid mulitple calls to DoublePrecisionVertices(). It is most efficient to make one call, save a local reference, and use the local reference as needed.

@verbatim
// add a bunch of double precision information
ON_3dPointArray& dv = mesh.DoublePrecisionVertices();
for ( i = 0; i < lots; i++ )
{
dv[i] = ...
}
// This call updates the single precison values
// in m_V[] and sets all the counts and CRCs that
// are used in validity checking.
mesh.UpdateSinglePrecisonVertices();
@endverbatim

◆ DoublePrecisionVertices() [2/2]

const ON_3dPointArray& ON_Mesh::DoublePrecisionVertices ( ) const

◆ Dump()

void ON_Mesh::Dump ( ON_TextLog ) const
overridevirtual

Creates a text dump of the object.

Dump() is intended for debugging and is not suitable for creating high quality text descriptions of an object.

The default implementations of this virtual function prints the class's name.

Reimplemented from ON_Object.

◆ DuplicateFace()

ON_Mesh* ON_Mesh::DuplicateFace ( int  face_index,
ON_Mesh mesh 
) const

Create a mesh that is a single face of this mesh.

Returns
A pointer to the submesh. If the input mesh parameter is null, then the caller must delete this mesh when it is no longer needed. If the input is invalid, then null is returned.

◆ EmergencyDestroy()

void ON_Mesh::EmergencyDestroy ( )

◆ EvaluateMeshGeometry()

bool ON_Mesh::EvaluateMeshGeometry ( const ON_Surface )

◆ EvaluatePoint()

bool ON_Mesh::EvaluatePoint ( const class ON_ObjRef objref,
ON_3dPoint P 
) const
overridevirtual

virtual ON_Geometry override

Reimplemented from ON_Geometry.

◆ FaceCount()

int ON_Mesh::FaceCount ( ) const

◆ FaceIsHidden()

bool ON_Mesh::FaceIsHidden ( int  meshvi) const

Returns true if the mesh face is hidden. This is a runtime setting that is not saved in 3dm files.

Parameters
meshfi[in] mesh face index.
Returns
True if mesh face is hidden.

A face is hidden if, and only if, at least one of its vertices is hidden.

◆ FaceUnsignedCount()

unsigned int ON_Mesh::FaceUnsignedCount ( ) const

◆ Flip()

void ON_Mesh::Flip ( )

◆ FlipFaceNormals()

void ON_Mesh::FlipFaceNormals ( )

◆ FlipFaceOrientation()

void ON_Mesh::FlipFaceOrientation ( )

◆ FlipNgonOrientation()

void ON_Mesh::FlipNgonOrientation ( )

◆ FlipVertexNormals()

void ON_Mesh::FlipVertexNormals ( )

◆ GetBBox()

bool ON_Mesh::GetBBox ( double *  boxmin,
double *  boxmax,
bool  bGrowBox = false 
) const
overridevirtual

virtual ON_Geometry GetBBox override

Reimplemented from ON_Geometry.

◆ GetClashingFacePairs()

int ON_Mesh::GetClashingFacePairs ( int  max_pair_count,
ON_SimpleArray< ON_2dex > &  clashing_pairs 
) const

Get a list of pairs of faces that clash.

Parameters
max_pair_count[in] If max_pair_count > 0, then at most this many pairs will be appended to the clashing_pairs[] array. If max_pair_count <= 0, then all clashing pairs will be appended to the clashing_pairs[] array.
clashing_pairs[out] The faces indices of clashing pairs are appended to this array.
Returns
Number of pairs appended to clashing_pairs[].

◆ GetConnectedComponents() [1/2]

int ON_Mesh::GetConnectedComponents ( bool  bUseVertexConnections,
bool  bTopologicalConnections,
ON_SimpleArray< int > &  facet_component_labels 
) const

Calculates the components of a mesh and sets a label for each face in the facet_component_labels array.

Parameters
bUseVertexConnections[in] If this parameter is true, then facets that share a common vertex are considered connected. If this parameter is false, then facets must share an edge to be considered connected.
bUseTopologicalConnections[in] If this parameter is true, then geometric location is used to determine if facets are connected. If this parameter is false, then facets must share the same vertex or vertices to be considered connected.
facet_component_labels[out] facet_component_labels[] will be an array with the same size as ON_Mesh.m_F.Count() and facet_component_labels[i] is the component id m_F[i] belongs to. The component id will be 1 to the number of compoents.
Returns
Number of components on success, 0 on failure

◆ GetConnectedComponents() [2/2]

int ON_Mesh::GetConnectedComponents ( bool  bUseVertexConnections,
bool  bTopologicalConnections,
ON_SimpleArray< ON_Mesh *> *  components 
) const

Calculates the components of a mesh and sets a label for each face in the facet_component_labels array.

Parameters
bUseVertexConnections[in] If this parameter is true, then facets that share a common vertex are considered connected. If this parameter is false, then facets must share an edge to be considered connected.
bUseTopologicalConnections[in] If this parameter is true, then geometric location is used to determine if facets are connected. If this parameter is false, then facets must share the same vertex or vertices to be considered connected.
components[out] New components are appended to this array if this parameter is null, then the components are just counted.
Returns
Number of components on success, 0 on failure

◆ GetCurvatureStats()

bool ON_Mesh::GetCurvatureStats ( ON::curvature_style  ,
ON_MeshCurvatureStats  
) const

◆ GetMeshEdges()

int ON_Mesh::GetMeshEdges ( ON_SimpleArray< ON_2dex > &  edges) const

Appends a list of mesh edges to the edges[] array.

Parameters
edges[out] Each edges[] element is a pair of vertex indices. There is at least one face in the mesh with an edge running between the indicies.
Returns
Number of ON_2dex values appended to the edges[] array.

◆ GetMeshFaceSideList()

unsigned int ON_Mesh::GetMeshFaceSideList ( const unsigned int *  Vid,
class ON_MeshFaceSide *&  sides 
) const

Get a list of the sides of every face.

Parameters
Vid[in] (can be null) If Vid is null, then the mesh m_V[] index values are used to set the ON_MeshFaceSide::vi[] values. If Vid is not null, then it must be an array of length VertexCount(). The value Vid[mesh m_V[] index] will be used to set the ON_MeshFaceSide::vi[] values.
sides[out] If the input value of sides is not null, then sides[] must be long enough to hold the returned side list. The maximum posssible length is 4*FaceCount() for a mesh contining FaceCount() nondegenerate quads. If the input value of sides is null, memory will be allocated using onmalloc() and the caller is responsible for calling onfree() at an appropriate time. This function fills in the sides[] array with face side information. The returned list is sorted by sides[].fi and the sides[].side and each element has vi[0] <= vi[1]. The function ON_SortMeshFaceSidesByVertexIndex() can be used to sort the list by the sides[].vi[] values.
Returns
Number of elements added to sides[].

Faces with out of range ON_MeshFace.vi[] values are skipped. Degenerate faces are processed, but degenerate sides (equal vertex indices) are not added to the list.

◆ GetNgonBoundaryPoints() [1/2]

unsigned int ON_Mesh::GetNgonBoundaryPoints ( const ON_MeshNgon ngon,
bool  bAppendStartPoint,
ON_SimpleArray< ON_3dPoint > &  ngon_boundary_points 
) const
Parameters
ngon[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.

◆ GetNgonBoundaryPoints() [2/2]

unsigned int ON_Mesh::GetNgonBoundaryPoints ( const ON_MeshNgon ngon,
bool  bAppendStartPoint,
ON_3dPoint ngon_boundary_points 
) const
Parameters
ngon[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.

◆ GetNgonOuterBoundary()

unsigned int ON_Mesh::GetNgonOuterBoundary ( unsigned int  ngon_fi_count,
const unsigned int *  ngon_fi,
ON_SimpleArray< unsigned int > &  ngon_vi 
) const

◆ GetTightBoundingBox() [1/2]

bool ON_Mesh::GetTightBoundingBox ( class ON_BoundingBox tight_bbox,
bool  bGrowBox = false,
const class ON_Xform xform = nullptr 
) const
overridevirtual

virtual ON_Geometry GetTightBoundingBox override

Reimplemented from ON_Geometry.

◆ GetTightBoundingBox() [2/2]

bool ON_Mesh::GetTightBoundingBox ( ON_BoundingBox tight_bbox,
bool  bGrowBox,
const ON_SimpleArray< ON_PlaneEquation > &  clipping_planes,
const ON_Xform xform = nullptr 
) const

◆ GetVertexEdges()

int ON_Mesh::GetVertexEdges ( int  vcount,
const int *  vertex_index,
bool  bNoDuplicates,
ON_SimpleArray< ON_2dex > &  edges 
) const

Appends a list of mesh edges that begin or end at the specified vertices to the edges[] array.

Parameters
vcount[in] number of vertices
vertex_index[in] array of vertex indices
bNoDuplicates[in] If true, then only one edges[] is added for each edge, the first vertex index will alwasy be less than the second, and the returned elements are sorted in dictionary order. If false and an edge is shared by multiple faces, then there will be an edges[] element added for each face and the order of the vertex indicies will indicate the orientation of the edge with respect to the face. No sorting is performed in this case.
edges[out] Edges that begin or end at one of the specified vertices are appended to this array. Each ON_2dex records the start and end vertex index.
Returns
Number of ON_2dex values appended to the edges[] array.

◆ GetVertexLocationIds()

unsigned int* ON_Mesh::GetVertexLocationIds ( unsigned int  first_vid,
unsigned int *  Vid,
unsigned int *  Vindex 
) const

Assign a unique id to each vertex location. Coincident vertices get the same id.

Parameters
first_vid[in] Initial vertex id. Typically 1 or 0.
Vid[out] If not null, then Vid[] sould be an array of length VertexCount(). and the vertex ids will be stored in this array. If null, the array will be allocated by calling onmalloc(). The returned array Vid[i] is the id of the vertex m_V[i]. If m_V[i] and m_V[j] are the same 3d point, then Vid[i] and Vid[j] will have the same value.
Vindex[out] (can be null) If Vindex is not null, then it must have length at least m_V.Count() and the returned array will be a permutation of (0,1,...,m_V.Count()-1) such (Vid[Vindex[0]], Vid[Vindex[1]], ..., Vid[Vindex[m_V.Count()-1]]) is an increasing list of value.
Returns
null if the mesh has no vertices. An array of length VertexCount(). If vertices m_V[i] and m_V[j] are coincident, then Vid[i] = Vid[j]. The id values begin at first_vid. The maximum vertex id is Vid[Vindex[m_V.Count()-1]]. The number of unique vertex locations is (Vid[Vindex[m_V.Count()-1]] - first_vid + 1).

◆ HasCachedTextureCoordinates()

bool ON_Mesh::HasCachedTextureCoordinates ( ) const

◆ HasDoublePrecisionVertices()

bool ON_Mesh::HasDoublePrecisionVertices ( ) const
Returns
True if the mesh has double precision vertices (m_dV.Count() > 0).

Use ON_Mesh::UpdateDoublePrecisionVertices() or ON_Mesh::UpdateSinglePrecisionVertices() to synchronize values of single and double precision vertices.

◆ HasFaceNormals()

bool ON_Mesh::HasFaceNormals ( ) const

◆ HasMeshTopology()

bool ON_Mesh::HasMeshTopology ( ) const

◆ HasNgons()

bool ON_Mesh::HasNgons ( ) const
Returns
True if the mesh has ngons.

◆ HasPackedTextureRegion()

bool ON_Mesh::HasPackedTextureRegion ( ) const
Returns
True if the m_srf_scale[] values are positive and the m_packed_tex_domain[] intervals are set to values that describe a proper subrectangle of (0,1)x(0,1). True does not necessarily mean the current values in m_T[] are packed texture coordinates.

◆ HasPrincipalCurvatures()

bool ON_Mesh::HasPrincipalCurvatures ( ) const

◆ HasSinglePrecisionVertices()

bool ON_Mesh::HasSinglePrecisionVertices ( ) const

◆ HasSurfaceParameters()

bool ON_Mesh::HasSurfaceParameters ( ) const

◆ HasSynchronizedDoubleAndSinglePrecisionVertices()

bool ON_Mesh::HasSynchronizedDoubleAndSinglePrecisionVertices ( ) const
Returns
True if the mesh vertex count is > 0, the mesh has single and double precision vertices, and the values of the locations are synchronized.

◆ HasTextureCoordinates()

bool ON_Mesh::HasTextureCoordinates ( ) const

◆ HasVertexColors()

bool ON_Mesh::HasVertexColors ( ) const

◆ HasVertexNormals()

bool ON_Mesh::HasVertexNormals ( ) const

◆ HiddenVertexArray()

const bool* ON_Mesh::HiddenVertexArray ( ) const
Returns
If the mesh has some hidden vertices, then an array of length VertexCount() is returned and the i-th element is true if the i-th vertex is hidden. If no vertices are hidden, nullptr is returned.

◆ HiddenVertexCount()

int ON_Mesh::HiddenVertexCount ( ) const
Returns
Number of vertices that are hidden.

◆ InsertNgon()

bool ON_Mesh::InsertNgon ( unsigned int  ngon_index,
const ON_MeshNgon ngon 
)

Insert an n-gon in the ngon list. This is generally slow. Use AddNgon or ModifyNgon.

◆ InvalidateBoundingBoxes()

void ON_Mesh::InvalidateBoundingBoxes ( )

◆ InvalidateCurvatureStats()

void ON_Mesh::InvalidateCurvatureStats ( )

◆ InvalidateTextureCoordinateBoundingBox()

void ON_Mesh::InvalidateTextureCoordinateBoundingBox ( )

◆ InvalidateVertexBoundingBox()

void ON_Mesh::InvalidateVertexBoundingBox ( )

◆ InvalidateVertexNormalBoundingBox()

void ON_Mesh::InvalidateVertexNormalBoundingBox ( )

◆ InvalidFaceCount()

int ON_Mesh::InvalidFaceCount ( ) const

◆ IsClosed()

bool ON_Mesh::IsClosed ( ) const
Returns
True if every mesh "edge" has two or more faces.

◆ IsDeformable()

bool ON_Mesh::IsDeformable ( ) const
overridevirtual

virtual ON_Geometry::IsDeformable() override

Reimplemented from ON_Geometry.

◆ IsEmpty()

bool ON_Mesh::IsEmpty ( ) const

◆ IsManifold() [1/2]

bool ON_Mesh::IsManifold ( ) const
Returns
True if every mesh "edge" has at most two faces.

◆ IsManifold() [2/2]

bool ON_Mesh::IsManifold ( bool  bTopologicalTest,
bool *  pbIsOriented = nullptr,
bool *  pbHasBoundary = nullptr 
) const

Determine if the mesh is a manifold.

Parameters
bTopologicalTest[in] If true, the query treats coincident vertices as the same.
pbIsOriented[out] If the input pointer is not nullptr, then the returned value of *pbIsOriented will be true if the mesh is a manifold and adjacent faces have compatible face normals.
pbHasBoundary[out] If the input pointer is not nullptr, then the returned value of *pbHasBoundary will be true if the mesh is a manifold and there is at least one "edge" with no adjacent faces have compatible face normals.
Returns
True if every mesh "edge" has at most two adjacent faces.

◆ IsOriented()

bool ON_Mesh::IsOriented ( ) const
Returns
True if the mesh is manifold and every pair of faces that share an "edge" have compatible orientations.

◆ IsPointInside()

bool ON_Mesh::IsPointInside ( ON_3dPoint  test_point,
double  tolerance,
bool  bStrictlyInside 
) const

Determine if a point is inside a solid brep. Paramters: test_point - [in] tolerance - [in] >= 0.0 3d distance tolerance used for ray-mesh intersection and determining strict inclusion. bStrictlyInside - [in] If bStrictlyInside is true, then test_point must be inside mesh by at least tolerance in order for this function to return true. If bStrictlyInside is false, then this function will return true if test_point is inside or the distance from test_point to a mesh face is <= tolerance.

Returns
True if test_point is inside the solid mesh.

The caller is responsible for making certing the mesh is solid before calling this function. If the mesh is not solid, the behavior is unpredictable.

See also
ON_Mesh::IsSolid()

◆ IsSolid()

bool ON_Mesh::IsSolid ( ) const

Test mesh to see if it is a solid. (A "solid" is a closed oriented manifold.)

Returns
true mesh is a solid fals mesh is not a solid
See also
ON_Mesh::SolidOrientation, ON_Mesh::IsManifold

◆ IsSwappableEdge()

bool ON_Mesh::IsSwappableEdge ( int  topei)

Tests a mesh edge to see if it is valid as input to ON_Mesh::SwapMeshEdge.

Parameters
topei[in] index of edge in MeshTopology().m_tope[] array
Returns
true if edge can be swapped by ON_Mesh::SwapMeshEdge.
See also
ON_Mesh::SwapEdge

◆ IsValid()

bool ON_Mesh::IsValid ( class ON_TextLog text_log = nullptr) const
overridevirtual

Tests an object to see if its data members are correctly initialized.

Parameters
text_log[in] if the object is not valid and text_log is not nullptr, then a brief englis description of the reason the object is not valid is appened to the log. The information appended to text_log is suitable for
lowlevel debugging purposes by programmers and is not intended to be useful as a high level user interface tool.
Returns
table true object is valid false object is invalid, uninitialized, etc.

Reimplemented from ON_Geometry.

◆ IsValidMeshComponentIndex()

bool ON_Mesh::IsValidMeshComponentIndex ( ON_COMPONENT_INDEX  ci) const
Parameters
ci[in] component index to test
Returns
True if ci identifies a component (vertex, edge, face, ngon) that exists in this mesh.

◆ IsValidNewNgonInformation()

bool ON_Mesh::IsValidNewNgonInformation ( unsigned int  Vcount,
const unsigned int *  ngon_vi,
unsigned int  Fcount,
const unsigned int *  ngon_fi 
) const
Parameters
Vcount[in] Number of vertices and sides in the n-gon.
ngon_vi[in]
Returns
true if the n-gon information is valid for adding an n-gon to this mesh.

◆ MakeDeformable()

bool ON_Mesh::MakeDeformable ( )
overridevirtual

virtual ON_Geometry::MakeDeformable() override

Reimplemented from ON_Geometry.

◆ MemoryRelocate()

void ON_Mesh::MemoryRelocate ( )
overridevirtual

Override of virtual ON_Object::MemoryRelocate.

Reimplemented from ON_Object.

◆ MeshComponent()

class ON_MeshComponentRef* ON_Mesh::MeshComponent ( ON_COMPONENT_INDEX  ci) const
Parameters
ci[in] a component index with type mesh_vertex, meshtop_vertex, meshtop_edge, or mesh_face.
Returns
A pointer to an ON_MeshComponentRef The caller must delete the returned object when it is no longer needed.

◆ MeshComponentRef()

class ON_MeshComponentRef ON_Mesh::MeshComponentRef ( ON_COMPONENT_INDEX  ci) const

◆ MeshParameters()

const ON_MeshParameters* ON_Mesh::MeshParameters ( ) const

◆ MeshPart()

ON_Mesh* ON_Mesh::MeshPart ( const ON_MeshPart mesh_part,
ON_Mesh mesh 
) const

Extract the portion of this mesh defined by mesh_part.

Parameters
mesh_part[in] defines portion of the mesh to extract.
mesh[in] (can be null, cannot be = "this). If mesh is no null, the extracted mesh will be put into this mesh. If mesh is null, the extracted mesh will be created in a mesh allocated on the heap using the new operator.
Returns
A pointer to the submesh. If the input mesh parameter is null, then the caller must delete this mesh when it is no longer needed. If the input is invalid, then null is returned.

◆ ModifyNgon() [1/2]

bool ON_Mesh::ModifyNgon ( unsigned int  ngon_index,
unsigned int  Vcount,
const unsigned int *  ngon_vi,
unsigned int  Fcount,
const unsigned int *  ngon_fi 
)

◆ ModifyNgon() [2/2]

bool ON_Mesh::ModifyNgon ( unsigned int  ngon_index,
const ON_MeshNgon ngon 
)

◆ Ngon()

const ON_MeshNgon* ON_Mesh::Ngon ( unsigned int  ngon_index) const
Parameters
ngon_index[in] Index of an ngon.
Returns
A pointetr to the indexed n-gon or null if the indexed ngon is null or ngon_index is out of range.

If ON_Mesh::RemoveNgon has been called, then a null pointer can be returned even when ngon_index >= 0 and ngon_index < ON_Mesh.NgonCount().

◆ NgonBoundaryBoundingBox() [1/2]

ON_BoundingBox ON_Mesh::NgonBoundaryBoundingBox ( unsigned int  ngon_index) const
Returns
Bounding box of the n-gon vertex locations.

◆ NgonBoundaryBoundingBox() [2/2]

ON_BoundingBox ON_Mesh::NgonBoundaryBoundingBox ( const ON_MeshNgon ngon) const
Returns
Bounding box of the n-gon vertex locations.

◆ NgonBoundaryEdgeCount()

unsigned int ON_Mesh::NgonBoundaryEdgeCount ( unsigned int  ngon_index) const
Parameters
ngon_index[in] Index of an ngon.
Returns
Total number of boundary edges, including interior edges

◆ NgonCenter() [1/2]

ON_3dPoint ON_Mesh::NgonCenter ( unsigned int  ngon_index) const
Returns
Average of the n-gon vertex locations.

◆ NgonCenter() [2/2]

ON_3dPoint ON_Mesh::NgonCenter ( const ON_MeshNgon ngon) const
Returns
Average of the n-gon vertex locations.

◆ NgonCount()

int ON_Mesh::NgonCount ( ) const

Number of n-gons in this mesh.

◆ NgonFromComponentIndex()

const ON_MeshNgon* ON_Mesh::NgonFromComponentIndex ( class ON_MeshNgonBuffer ngon_buffer,
ON_COMPONENT_INDEX  ci 
) const

◆ NgonIndexFromFaceIndex()

unsigned int ON_Mesh::NgonIndexFromFaceIndex ( unsigned int  face_index) const
Parameters
face_index[in] Mesh face ON_Mesh.m_F[] index.
Returns
ON_UNSET_UINT_INDEX: The face is not part of an n-gon. Otherwise: Index of the n-gon the face is part of.

◆ NgonMap() [1/2]

const unsigned int* ON_Mesh::NgonMap ( ) const
Returns
null: The ngonMap does not exist. an array of length m_F.Count(): The value of the i-th element is either the index of the n-gon the mesh face m_F[i] belongs to or ON_UNSET_UINT_INDEX when m_F[i] does not belong to an n-gon.

◆ NgonMap() [2/2]

const unsigned int* ON_Mesh::NgonMap ( bool  bCreateIfMissing)

◆ Ngons()

const ON_MeshNgon* const* ON_Mesh::Ngons ( ) const
Returns
null - This mesh does ot have n-gon information. not null - a pointer to an array of ON_MeshNgon pointers. The array has length ON_Mesh::NgonCount().

If ON_Mesh::RemoveNgon has been called, then the array can contain null pointers.

◆ NgonUnsignedCount()

unsigned int ON_Mesh::NgonUnsignedCount ( ) const

Number of n-gons in this mesh.

◆ NormalizeTextureCoordinates()

bool ON_Mesh::NormalizeTextureCoordinates ( )

◆ ObjectType()

ON::object_type ON_Mesh::ObjectType ( ) const
overridevirtual

Useful for switch statements that need to differentiate between basic object types like points, curves, surfaces, and so on.

Returns

ON::object_type enum value.

The default implementation of this virtual function returns ON::unknown_object_type

Reimplemented from ON_Object.

◆ operator=()

ON_Mesh& ON_Mesh::operator= ( const ON_Mesh )

◆ OrientNgons()

bool ON_Mesh::OrientNgons ( bool  bPermitHoles)

If the mesh has ngons with ON_MeshNgon.Orientation() = -1, the reverse the ngon's boundary orientation.

Parameters
bPermitHoles[in] ngons may contain holes.
Returns
True if all non-empty ngons have ON_MeshNgon.Orientation()=1 after the call.

◆ Partition()

const ON_MeshPartition* ON_Mesh::Partition ( ) const

◆ QuadCount()

int ON_Mesh::QuadCount ( ) const

◆ Read()

bool ON_Mesh::Read ( ON_BinaryArchive binary_archive)
overridevirtual

Low level archive writing tool used by ON_BinaryArchive::ReadObject().

Parameters
binary_archivearchive to read from
Returns
Returns true if the read is successful.

Use ON_BinaryArchive::ReadObject() to read objects. This Read() function should read the objects definition back into its data members.

The default implementation of this virtual function returns false and does nothing.

Reimplemented from ON_Object.

◆ RemoveAllNgons()

void ON_Mesh::RemoveAllNgons ( )

Remove all entries from the ON_Mesh n-gon list.

Same as SetNgonCount(0)

◆ RemoveEmptyNgons()

void ON_Mesh::RemoveEmptyNgons ( )

Remove null and empty entries from the ON_Mesh n-gon list.

◆ RemoveNgon()

bool ON_Mesh::RemoveNgon ( unsigned int  ngon_index)

Remove an n-gon.

Parameters
ngon_index[in]
Returns
True if ngon_index was valid and the corresponding n-gon was removed.

The mesh triangles that make up the n-gon are not deleted.

◆ RemoveNgonInteriorVertices()

bool ON_Mesh::RemoveNgonInteriorVertices ( const unsigned int *const *  vertex_face_map,
unsigned int  ngon_index0,
unsigned int  ngon_index1 
)

For each ngon with index in the specified range that has interior vertices, remove the interior vertices and triangluate the ngon.

Parameters
vertex_face_map[in]
  • Pass null if you don't have one.
  • See ON_MeshVertexFaceMap for details about making one. The only reason to pass one in is because you need it for other reasons or you already have one.
  • If true is returned, then the information in this vertex_face_map will be invalid because vertices will be removed.
ngon_index0[in]
ngon_index1[in] ngons with indices ni satisfying ngon_index0 <= ni < ngon_index1 will be separated. To separate every ngon in a mesh, pass ngon_index0 = 0 and ngon_index1 = mesh->NgonCount().
Returns
true one or more vertices were removed and one or more ngons were triangluated. This changes the mesh's vertex and face information and invalidates any input vertex_face_map. false The mesh was not modified.

If true is returned and you are finished modify the mesh, then call ON_Mesh::Compact() or ON_Mesh::CullUnusedVertices() to remove the unreferenced interior vertices.

◆ RemoveNgonMap()

void ON_Mesh::RemoveNgonMap ( )

Removes any existing n-gon map. Does not remove other n-gon information.

◆ RemoveNgons()

unsigned int ON_Mesh::RemoveNgons ( unsigned int  ngon_index_count,
const unsigned int *  ngon_index_list 
)

◆ ReserveVertexCapacity()

bool ON_Mesh::ReserveVertexCapacity ( size_t  new_vertex_capacity)

Increases the capactiy of arrays used to hold vertex information.

Parameters
new_vertex_capacity[in] desired capacity
Returns
true if successful.

This function is useful if you are getting ready to add a known number of vertices and want to increase the dynamic array capacities before you begin adding vertices.

◆ ReverseSurfaceParameters()

bool ON_Mesh::ReverseSurfaceParameters ( int  dir)

◆ ReverseTextureCoordinates()

bool ON_Mesh::ReverseTextureCoordinates ( int  dir)

Reverse one coordinate direction of the texture coordinates, within texture domain m_tex_domain

Parameters
dir[in] - dir=0 first texture coordinate is reversed dir=1 second texture coordinate is reversed Returns
truesuccess

◆ SeparateNgons()

bool ON_Mesh::SeparateNgons ( unsigned int **  vertex_face_map,
unsigned int  ngon_index0,
unsigned int  ngon_index1 
)

For each ngon with index in the specified range, duplicate vertices as needed so that the ngon does not share any vertices with faces that do not belong to the ngon.

Parameters
vertex_face_map[in]
  • Pass null if you don't have one.
  • See ON_MeshVertexFaceMap for details about making one. The only reason to pass one in is because you need it for other reasons or you already have one.
  • Note that if true is returned, then the information in this vertex_face_map will be changed and no information will be added for the new vertices.
ngon_index0[in]
ngon_index1[in] ngons with indices ni satisfying ngon_index0 <= ni < ngon_index1 will be separated. To separate every ngon in a mesh, pass ngon_index0 = 0 and ngon_index1 = mesh->NgonCount().
Returns
true one or more vertices were duplicated to separate an ngon from it's neighboring faces. This changes the mesh's vertex and face information and invalidates any input vertex_face_map. false The mesh was not modified.

◆ SetCachedTextureCoordinates()

const ON_TextureCoordinates* ON_Mesh::SetCachedTextureCoordinates ( const class ON_TextureMapping mapping,
const class ON_Xform mesh_xform = 0,
bool  bLazy = true 
)

◆ SetClosed()

void ON_Mesh::SetClosed ( int  closed)

Expert user function to set m_is_closed member. Setting this value correctly after a mesh is constructed can save time when IsClosed() is called. This function sets the private member variable m_is_closed. Paramters: closed - [in] 0: The mesh is not closed. There is at least one face with an edge that is geometrically distinct (as an unoriented line segment) from all other edges. 1: The mesh is closed. Every geometrically distict edge is used by two or more faces.

◆ SetMeshParameters()

void ON_Mesh::SetMeshParameters ( const ON_MeshParameters )

◆ SetNgonCount()

void ON_Mesh::SetNgonCount ( unsigned int  ngon_count)

Set the n-gon count. Null n-gons are be appended when ngon_count > current count. Existing n-gons are removed when ngon_count < current count.

Parameters
ngon_count[in] Number of n-gons to have. 0: removes all ngons.

The mesh triangles that make up any removed n-gons are not deleted.

◆ SetNgonVertexNormals()

bool ON_Mesh::SetNgonVertexNormals ( unsigned int  ngon_index0,
unsigned int  ngon_index1 
)

For each ngon with index in the specified range, all vertices in the ngon will have their vertex normal set to the normal of the first face in the ngon.

Parameters
ngon_index0[in]
ngon_index1[in] ngons with indices ni satisfying ngon_index0 <= ni < ngon_index1 will be separated. To separate every ngon in a mesh, pass ngon_index0 = 0 and ngon_index1 = mesh->NgonCount().
Returns
true one or more vertices were duplicated to separate an ngon from it's neighboring faces. This changes the mesh's vertex and face information and invalidates any input vertex_face_map. false The mesh was not modified.

◆ SetQuad()

bool ON_Mesh::SetQuad ( int  ,
int  ,
int  ,
int  ,
int   
)

◆ SetSolidOrientation()

void ON_Mesh::SetSolidOrientation ( int  solid_orientation)

Expert user function to set m_is_solid member. Setting this value correctly after a mesh is constructed can save time when IsSolid() is called. This function sets the private member variable m_is_solid. If solid is nonzero, it will set m_is_closed to 1. Paramters: solid - [in] 0: The mesh is not an oriented manifold solid mesh. Either the mesh is not closed, not manifold, or the faces are not oriented compatibly. 1: The mesh is an oriented manifold solid whose face normals point outwards. -1: The mesh is an oriented manifold solid whose face normals point inwards.

◆ SetSurfaceParamtersFromTextureCoodinates()

bool ON_Mesh::SetSurfaceParamtersFromTextureCoodinates ( )

If the mesh does not have surface evaulation parameters, has texture coordinates, and the surface parameters can be set in a way so the existing texture coordinates can be computed from the surface parameters, then this function sets the surface parameters. This is useful when meshes that have texture coordinates and do not have surface parameters want ot set the surface parameters in a way so that the texture mapping ON_TextureMapping::SurfaceParameterTextureMapping will restore the texture coordinates.

Returns
true - successful false - failure - no changes made to the mesh.

◆ SetTextureCoord()

bool ON_Mesh::SetTextureCoord ( int  ,
double  ,
double   
)

◆ SetTextureCoordinates()

bool ON_Mesh::SetTextureCoordinates ( const class ON_TextureMapping mapping,
const class ON_Xform mesh_xform = 0,
bool  bLazy = true 
)

Use a texture mapping function to set the m_T[] values.

Parameters
mapping[in]
mesh_xform[in] If not nullptr, the mapping calculation is performed as if the mesh were transformed by mesh_xform; the location of the mesh is not changed.
bLazy[in] If true and the m_T[] values were set using the same mapping parameters, then no calculation is performed.
Returns
True if successful.
See also
ON_TextureMapping::GetTextureCoordinates

◆ SetTriangle()

bool ON_Mesh::SetTriangle ( int  ,
int  ,
int  ,
int   
)

◆ SetVertex() [1/2]

bool ON_Mesh::SetVertex ( int  ,
const ON_3dPoint  
)

creation

◆ SetVertex() [2/2]

bool ON_Mesh::SetVertex ( int  ,
const ON_3fPoint  
)

◆ SetVertexHiddenFlag()

void ON_Mesh::SetVertexHiddenFlag ( int  meshvi,
bool  bHidden 
)

Set the runtime vertex hidden flag.

Parameters
meshvi[in] mesh vertex index
bHidden[in] true to hide vertex

◆ SetVertexNormal() [1/2]

bool ON_Mesh::SetVertexNormal ( int  ,
const ON_3dVector  
)

◆ SetVertexNormal() [2/2]

bool ON_Mesh::SetVertexNormal ( int  ,
const ON_3fVector  
)

◆ SizeOf()

unsigned int ON_Mesh::SizeOf ( ) const
overridevirtual

ON_Object overrides.

virtual ON_Object::SizeOf override

Reimplemented from ON_Object.

◆ SolidOrientation()

int ON_Mesh::SolidOrientation ( ) const

Determine orientation of a mesh.

Returns
+1 mesh is a solid with outward facing normals -1 mesh is a solid with inward facing normals 0 mesh is not a solid
See also
ON_Mesh::IsSolid

◆ SwapCoordinates()

bool ON_Mesh::SwapCoordinates ( int  i,
int  j 
)
overridevirtual

Swaps object coordinate values with indices i and j.

Parameters
i[in] coordinate index
j[in] coordinate index

The default implementation uses the virtual Transform() function to calculate the result. If you are creating an object where Transform() is slow, coordinate swapping will be frequently used, and coordinate swapping can be quickly accomplished, then override this function.

@verbatim
ON_Point point(7,8,9);
point.SwapCoordinates(0,2);
// point = (9,8,7)
@endverbatim

Reimplemented from ON_Geometry.

◆ SwapEdge()

bool ON_Mesh::SwapEdge ( int  topei)

If the edge is shared by two triangular face, then the edge is "swapped".

Parameters
topei[in] index of edge in MeshTopology().m_tope[] array
Returns
true if successful
See also
ON_Mesh::IsSwappableEdge

◆ Topology()

const ON_MeshTopology& ON_Mesh::Topology ( ) const

◆ TopologyExists()

bool ON_Mesh::TopologyExists ( ) const
Returns
This is an expert user function that returns true if the topology information is already calculated and cached. It can be used to to avoid calling the Topology() function when the expensive creation step will be performed.

◆ Transform()

bool ON_Mesh::Transform ( const ON_Xform xform)
overridevirtual

Transforms the object.

Parameters
xform[in] transformation to apply to object. If xform.IsSimilarity() is zero, then you may want to call MakeSquishy() before calling Transform.

Classes derived from ON_Geometry should call ON_Geometry::Transform() to handle user data transformations and then transform their definition.

See also
ON_Geometry::IsDeformable();,

Reimplemented from ON_Geometry.

◆ TransposeSurfaceParameters()

bool ON_Mesh::TransposeSurfaceParameters ( )

◆ TransposeTextureCoordinates()

bool ON_Mesh::TransposeTextureCoordinates ( )

Transposes the texture coordinates Returns true - success

◆ TriangleCount()

int ON_Mesh::TriangleCount ( ) const

◆ UnitizeFaceNormals()

bool ON_Mesh::UnitizeFaceNormals ( )

◆ UnitizeVertexNormals()

bool ON_Mesh::UnitizeVertexNormals ( )

◆ UpdateDoublePrecisionVertices()

void ON_Mesh::UpdateDoublePrecisionVertices ( )

If you modify the values of the single precision vertices in m_V[], then you must call UpdateDoublePrecisionVertices().

If double precision vertices are not present, this function does nothing.

◆ UpdateSinglePrecisionVertices()

void ON_Mesh::UpdateSinglePrecisionVertices ( )

If you modify the values of double precision vertices, then you must call UpdateSinglePrecisonVertices().

If double precision vertices are not present, this function does nothing.

◆ V4V5_DestroyNgonList()

void ON_Mesh::V4V5_DestroyNgonList ( )

Destroy any existing N-gon list.

◆ V4V5_ModifyNgonList()

class ON_V4V5_MeshNgonList* ON_Mesh::V4V5_ModifyNgonList ( )

If an N-gon list exists, it is returned and can be modified. If no N-gon list exists, a new empty list is returned and it can be modified.

Returns
A pointer to the N-gon list that can be modified.

◆ V4V5_NgonList()

const class ON_V4V5_MeshNgonList* ON_Mesh::V4V5_NgonList ( ) const

If the mesh has an N-gon list, return a pointer to it.

Returns
A pointer to the current N-gon list or nullptr.

◆ Vertex()

ON_3dPoint ON_Mesh::Vertex ( int  vertex_index) const
Returns
Location of the vertex. If double precision vertices are present, the double precision vertex location is returned. If vertex_index is out of range, ON_UNSET_VALUE is returned.

◆ VertexCount()

int ON_Mesh::VertexCount ( ) const

query

◆ VertexIsHidden()

bool ON_Mesh::VertexIsHidden ( int  meshvi) const

Returns true if the mesh vertex is hidden. This is a runtime setting that is not saved in 3dm files.

Parameters
meshvi[in] mesh vertex index.
Returns
True if mesh vertex is hidden.

◆ VertexUnsignedCount()

unsigned int ON_Mesh::VertexUnsignedCount ( ) const

◆ Write()

bool ON_Mesh::Write ( ON_BinaryArchive binary_archive) const
overridevirtual

Low level archive writing tool used by ON_BinaryArchive::WriteObject().

Parameters
binary_archivearchive to write to
Returns
Returns true if the write is successful.

Use ON_BinaryArchive::WriteObject() to write objects. This Write() function should just write the specific definition of this object. It should not write and any chunk typecode or length information.

The default implementation of this virtual function returns false and does nothing.

Reimplemented from ON_Object.

Member Data Documentation

◆ m_C

ON_SimpleArray<ON_Color> ON_Mesh::m_C

◆ m_Ctag

ON_MappingTag ON_Mesh::m_Ctag

Implementation - false color.

◆ m_dV

ON_3dPointArray ON_Mesh::m_dV

m_dV[] double precision vertices. m_V[] single precision vertices.

If m_dV[] is not empty, then m_V and m_dV should have the same length and HasSynchronizedDoubleAndSinglePrecisionVertices() should be true.

Otherwise a bug incorrectly modified vertex location information.

If m_dV[] and m_V[] are in use and you modify vertex locations or count, then your calculation should insure both are properly updated.

◆ m_F

ON_SimpleArray<ON_MeshFace> ON_Mesh::m_F

m_F[] facets (triangles or quads)

◆ m_FN

ON_3fVectorArray ON_Mesh::m_FN

◆ m_H

ON_SimpleArray<bool> ON_Mesh::m_H

Implementation - runtime vertex visibility - not saved in 3dm files.

◆ m_hidden_count

int ON_Mesh::m_hidden_count

◆ m_invalid_count

int ON_Mesh::m_invalid_count
protected

◆ m_K

Implementation - curvature.

◆ m_kstat

ON_MeshCurvatureStats* ON_Mesh::m_kstat[4]
protected

◆ m_mesh_parameters

ON_MeshParameters* ON_Mesh::m_mesh_parameters
protected

◆ m_N

ON_3fVectorArray ON_Mesh::m_N

◆ m_nbox

float ON_Mesh::m_nbox[2][3]
protected

◆ m_Ngon

ON_SimpleArray<ON_MeshNgon*> ON_Mesh::m_Ngon

◆ m_NgonAllocator

ON_MeshNgonAllocator ON_Mesh::m_NgonAllocator

◆ m_NgonMap

ON_SimpleArray<unsigned int> ON_Mesh::m_NgonMap

◆ m_packed_tex_domain

ON_Interval ON_Mesh::m_packed_tex_domain[2]

◆ m_packed_tex_rotate

bool ON_Mesh::m_packed_tex_rotate

◆ m_parent

const ON_Object* ON_Mesh::m_parent

Implementation - runtime UI information.

◆ m_partition

ON_MeshPartition* ON_Mesh::m_partition
protected

sub-mesh information rendering large meshes

◆ m_quad_count

int ON_Mesh::m_quad_count
protected

◆ m_S

ON_2dPointArray ON_Mesh::m_S

◆ m_srf_domain

ON_Interval ON_Mesh::m_srf_domain[2]

◆ m_srf_scale

double ON_Mesh::m_srf_scale[2]

◆ m_T

ON_2fPointArray ON_Mesh::m_T

◆ m_tbox

float ON_Mesh::m_tbox[2][2]
protected

◆ m_TC

◆ m_top

ON_MeshTopology ON_Mesh::m_top
protected

Implementation - mesh topology.

◆ m_triangle_count

int ON_Mesh::m_triangle_count
protected

◆ m_Ttag

ON_MappingTag ON_Mesh::m_Ttag

◆ m_V

ON_3fPointArray ON_Mesh::m_V