Rhino C++ API  8.6
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Attributes | List of all members
ON_Mesh Class Reference

#include <opennurbs_mesh.h>

Inheritance diagram for ON_Mesh:
ON_Geometry ON_Object

Public Member Functions

 ON_Mesh ()
 
 ON_Mesh (const ON_Mesh &)
 
 ON_Mesh (int initial_face_array_capacity, int initial_vertex_array_capacity, bool has_vertex_normals, bool has_texture_coordinates)
 
 ~ON_Mesh ()
 
int AddNgon (const ON_SimpleArray< unsigned int > &ngon_fi)
 
int AddNgon (const ON_SimpleArray< unsigned int > &ngon_fi, bool bPermitHoles)
 
unsigned int AddNgon (ON_MeshNgon *ngon)
 
int AddNgon (unsigned int Fcount, const unsigned int *ngon_fi)
 
int AddNgon (unsigned int Fcount, const unsigned int *ngon_fi, bool bPermitHoles)
 
int AddNgon (unsigned int Vcount, const unsigned int *ngon_vi, unsigned int Fcount, const unsigned int *ngon_fi)
 
int AddNgon_Expert (unsigned int Fcount, const unsigned int *ngon_fi, bool bPermitHoles, ON_MeshVertexFaceMap *vertexFaceMap)
 
unsigned int AddNgons (const ON_SimpleArray< ON_COMPONENT_INDEX > &ci_list)
 
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)
 
ON_MeshNgonAllocateNgon (unsigned int Vcount, unsigned int Fcount)
 
void Append (const ON_Mesh &)
 
void Append (int count, const ON_Mesh *const *meshes)
 
void Append (std::vector< std::shared_ptr< const ON_Mesh >>)
 
unsigned int AppendDuplicateVertex (unsigned int vertex_index)
 
double Area (double *error_estimate=nullptr) const
 
ON_3dPoint AreaCentroid (double *area=nullptr) const
 
bool AreaMassProperties (class ON_MassProperties &mp, bool bArea=true, bool bFirstMoments=true, bool bSecondMoments=true, bool bProductMoments=true) const
 
const ON_TextureCoordinatesCachedTextureCoordinates (const ON_UUID &mapping_id) const
 
void Cleanup (bool bRemoveNgons)
 
void Cleanup (bool bRemoveNgons, bool bRemoveDegenerateFaces, bool bCompact)
 
void ClearVertexColors ()
 
bool CollapseEdge (int topei)
 
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)
 
bool Compact ()
 
bool ComputeFaceNormal (int)
 computes face normal of indexed face More...
 
bool ComputeFaceNormals ()
 compute face normals for all faces More...
 
bool ComputeVertexNormals ()
 uses face normals to cook up a vertex normal More...
 
unsigned int ConvertNonPlanarQuadsToTriangles (double planar_tolerance, double angle_tolerance_radians, unsigned int split_method)
 
unsigned int ConvertNonPlanarQuadsToTriangles (double planar_tolerance, double angle_tolerance_radians, unsigned int split_method, bool bDeleteNgonsContainingSplitQuads)
 
bool ConvertQuadsToTriangles ()
 
bool ConvertTrianglesToQuads (double angle_tol_radians, double min_diagonal_length_ratio)
 
ON_MeshCopyComponents (const ON_COMPONENT_INDEX *ci_list, size_t ci_count, class ON_Mesh *destination_mesh) const
 
ON_MeshCopyComponents (const ON_SimpleArray< ON_COMPONENT_INDEX > &ci_list, class ON_Mesh *destination_mesh) const
 
bool CountQuads ()
 
const unsigned int * CreateNgonMap ()
 
bool CreateNgonMap (ON_SimpleArray< unsigned int > &map) const
 
bool CreateNgonMap (unsigned int *ngon_map) const
 
const ON_MeshPartitionCreatePartition (int, int)
 
int CullClashingFaces (int what_to_cull)
 
unsigned int CullDegenerateFaces ()
 returns number of degenerate faces More...
 
unsigned int CullDegenerates ()
 
int CullUnusedVertices ()
 returns number of culled vertices More...
 
ON__UINT32 DataCRC (ON__UINT32 current_remainder) const override
 virtual ON_Object::DataCRC override More...
 
bool DeallocateNgon (ON_MeshNgon *ngon)
 
bool DeleteComponent (ON_COMPONENT_INDEX ci)
 
bool DeleteComponents (const ON_COMPONENT_INDEX *ci_list, size_t ci_count) override
 
bool DeleteComponents (const ON_COMPONENT_INDEX *ci_list, size_t ci_count, bool bIgnoreInvalidComponents, bool bRemoveDegenerateFaces, bool bRemoveUnusedVertices, bool bRemoveEmptyNgons)
 
bool DeleteComponents (const ON_COMPONENT_INDEX *ci_list, size_t ci_count, bool bIgnoreInvalidComponents, bool bRemoveDegenerateFaces, bool bRemoveUnusedVertices, bool bRemoveEmptyNgons, unsigned int *faceMap)
 
bool DeleteComponents (const ON_SimpleArray< ON_COMPONENT_INDEX > &ci_list)
 
bool DeleteFace (int meshfi)
 
void DeleteMeshParameters ()
 
void Destroy ()
 
void DestroyDoublePrecisionVertices ()
 
void DestroyHiddenVertexArray ()
 
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...
 
unsigned int DissolveOrDelete (const ON_SimpleArray< ON_COMPONENT_INDEX > &ci_list)
 
ON_3dPointArrayDoublePrecisionVertices ()
 Implementation - mesh geometry. More...
 
const ON_3dPointArrayDoublePrecisionVertices () const
 
void Dump (ON_TextLog &) const override
 for debugging More...
 
bool DuplicateBorder (ON_SimpleArray< ON_Polyline * > &polylines, bool joinOverUnweldedVertices) const
 
ON_MeshDuplicateFace (int face_index, ON_Mesh *mesh) const
 
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
 
unsigned int FaceUnsignedCount () const
 
void Flip ()
 reverses face orientations and flips vertex and face normals More...
 
void FlipFaceNormals ()
 reverses face normals More...
 
void FlipFaceOrientation ()
 reverses face orientation (does nothing to normals) More...
 
void FlipNgonOrientation ()
 reverses ngon boundary direction More...
 
void FlipVertexNormals ()
 reverses vertex normals More...
 
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
 
bool GetClosestPoint (const ON_3dPoint &P, class ON_MESH_POINT *Q, double maximum_distance=0.0) const
 
int GetConnectedComponents (bool bUseVertexConnections, bool bTopologicalConnections, ON_SimpleArray< int > &facet_component_labels) const
 
int GetConnectedComponents (bool bUseVertexConnections, bool bTopologicalConnections, ON_SimpleArray< ON_Mesh * > *components) const
 
bool GetCurvatureStats (ON::curvature_style, ON_MeshCurvatureStats &) const
 
bool GetIntersections (const ON_SimpleArray< const ON_Mesh * > &withTheseOtherMeshes, double tolerance, ON_SimpleArray< ON_Polyline * > *perforatingResults, ON_SimpleArray< ON_Polyline * > *overlapResults, ON_Mesh *overlapMeshResult, ON_TextLog *log, ON_Terminator *cancel, ON_ProgressReporter *reporter) const
 
bool GetIntersections (const ON_SimpleArray< const ON_Mesh * > &withTheseOtherMeshes, ON_MeshIntersectionCache *cacheForOtherMeshes, double tolerance, ON_SimpleArray< ON_Polyline * > *perforatingResults, ON_SimpleArray< ON_Polyline * > *overlapResults, ON_Mesh *overlapMeshResult, ON_TextLog *log, ON_Terminator *cancel, ON_ProgressReporter *reporter) const
 
const ON_MappingMeshInfoGetMappingMeshInfo () const
 
unsigned int GetMeshEdgeList (ON_SimpleArray< ON_2dex > &edge_list, bool bLookForNgonInteriorEdges, bool bOmitHiddenEdges, ON_SimpleArray< int > &ci_meshtop_edge_map, ON_SimpleArray< int > &ci_meshtop_vertex_map, unsigned int edge_type_partition[6]) const
 
unsigned int GetMeshEdgeList (ON_SimpleArray< ON_2dex > &edge_list, bool bLookForNgonInteriorEdges, bool bOmitHiddenEdges, ON_SimpleArray< int > &ci_meshtop_edge_map, unsigned int edge_type_partition[6]) const
 
unsigned int GetMeshEdgeList (ON_SimpleArray< ON_2dex > &edge_list, bool bLookForNgonInteriorEdges, bool bOmitHiddenEdges, unsigned int edge_type_partition[6]) const
 
unsigned int GetMeshEdgeList (ON_SimpleArray< ON_2dex > &edge_list, bool bLookForNgonInteriorEdges, ON_SimpleArray< int > &ci_meshtop_edge_map, ON_SimpleArray< int > &ci_meshtop_vertex_map, unsigned int edge_type_partition[6]) const
 
unsigned int GetMeshEdgeList (ON_SimpleArray< ON_2dex > &edge_list, bool bLookForNgonInteriorEdges, ON_SimpleArray< int > &ci_meshtop_edge_map, unsigned int edge_type_partition[6]) const
 
unsigned int GetMeshEdgeList (ON_SimpleArray< ON_2dex > &edge_list, bool bLookForNgonInteriorEdges, unsigned int edge_type_partition[6]) const
 
int GetMeshEdges (ON_SimpleArray< ON_2dex > &edges) const
 
unsigned int GetMeshFaceSideList (const unsigned int *Vid, class ON_MeshFaceSide *&sides) const
 
unsigned int GetMeshNakedEdgeList (ON_SimpleArray< ON_2dex > &naked_edge_list, ON_SimpleArray< int > *ci_meshtop_vertex_map=nullptr, bool bLookForNgonInteriorEdges=false) const
 
unsigned int GetMeshNakedEdgeListEx (ON_SimpleArray< ON_2dex > &naked_edge_list, ON_SimpleArray< int > *ci_meshtop_vertex_map=nullptr, bool bLookForNgonInteriorEdges=false, ON_SimpleArray< ON_MeshFaceSide > *faceSides=nullptr) const
 
unsigned int GetNgonBoundaryPoints (const ON_MeshNgon *ngon, bool bAppendStartPoint, ON_3dPoint *ngon_boundary_points) const
 
unsigned int GetNgonBoundaryPoints (const ON_MeshNgon *ngon, bool bAppendStartPoint, ON_SimpleArray< 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
 
const ON_RenderMeshInfoGetRenderMeshInfo () const
 
bool GetSelfIntersections (double tolerance, ON_SimpleArray< ON_Polyline * > *perforatingResults, ON_SimpleArray< ON_Polyline * > *overlapResults, ON_Mesh *overlapMeshResult, ON_TextLog *log, ON_Terminator *cancel, ON_ProgressReporter *reporter) const
 
bool GetSilhouette (const ON_SilhouetteParameters parameters, const ON_PlaneEquation *clipping_planes, size_t clipping_plane_count, ON_ClassArray< ON_SIL_EVENT > &silhouettes, ON_ProgressReporter *progress, ON_Terminator *terminator) 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
 
unsigned int * GetVertexLocationIds (unsigned int first_vid, unsigned int *Vid, unsigned int *Vindex) const
 
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 HasVertexColors (ON_MappingTag color_tag) const
 
bool HasVertexNormals () const
 normals at vertices More...
 
const bool * HiddenVertexArray () const
 
int HiddenVertexCount () const
 
bool InsertNgon (unsigned int ngon_index, const ON_MeshNgon *ngon)
 
int IntersectMesh (const ON_Mesh &meshB, ON_ClassArray< ON_SimpleArray< ON_MMX_POINT > > &x, double intersection_tolerance=0.0, double overlap_tolerance=0.0) const
 
int IntersectMesh (const ON_Mesh &meshB, ON_SimpleArray< ON_Line > &lines) const
 
int IntersectPlane (ON_PlaneEquation plane_equation, double tolerance, ON_SimpleArray< ON_Polyline * > *perforations, ON_SimpleArray< ON_Polyline * > *overlaps, ON_MeshIntersectionCache *cache=nullptr) const
 
int IntersectPlane (ON_PlaneEquation plane_equation, ON_SimpleArray< ON_Line > &lines) const
 
void InvalidateBoundingBoxes ()
 directly manipulating the m_T[] array. More...
 
void InvalidateCachedTextureCoordinates (bool bOnlyInvalidateCachedSurfaceParameterMapping=false)
 
void InvalidateCurvatureStats ()
 directly manipulating the m_T[] array. More...
 
void InvalidateTextureCoordinateBoundingBox ()
 directly manipulating the m_N[] array. More...
 
void InvalidateVertexBoundingBox ()
 
void InvalidateVertexNormalBoundingBox ()
 directly manipulating the m_V[] array. More...
 
int InvalidFaceCount () const
 number of face that have invalid m_vi[] values. More...
 
bool IsClosed () const
 
bool IsCorrupt (bool bRepair, bool bSilentError, class ON_TextLog *text_log) 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
 
bool IsMorphable () const override
 virtual ON_Geometry override More...
 
bool IsNotEmpty () const
 
bool IsOriented () const
 
bool IsPointInside (ON_3dPoint test_point, double tolerance, bool bStrictlyInside) const
 
bool IsSolid () const
 
bool IsSwappableEdge (int topei)
 
bool IsValid (class ON_TextLog *text_log=nullptr) const override
 
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...
 
unsigned int MergeFaceSets (const ON_SimpleArray< ON_COMPONENT_INDEX > &ci_list)
 
class ON_MeshComponentRefMeshComponent (ON_COMPONENT_INDEX ci) const
 
class ON_MeshComponentRef MeshComponentRef (ON_COMPONENT_INDEX ci) const
 
const class ON_RTreeMeshFaceTree (bool bCreateIfNoneExists) const
 
const ON_MeshParametersMeshParameters () const
 
ON_MeshMeshPart (const ON_MeshPart &mesh_part, ON_Mesh *mesh) const
 
const class ON_MeshTreeMeshTree () const
 
const class ON_MeshTreeMeshTree (bool bCreateIfNoneExists) const
 
bool ModifyNgon (unsigned int ngon_index, const ON_MeshNgon *ngon)
 
bool ModifyNgon (unsigned int ngon_index, unsigned int Vcount, const unsigned int *ngon_vi, unsigned int Fcount, const unsigned int *ngon_fi)
 
bool Morph (const ON_SpaceMorph &morph) override
 virtual ON_Geometry override More...
 
const ON_MeshNgonNgon (unsigned int ngon_index) const
 
ON_BoundingBox NgonBoundaryBoundingBox (const ON_MeshNgon *ngon) const
 
ON_BoundingBox NgonBoundaryBoundingBox (unsigned int ngon_index) const
 
unsigned int NgonBoundaryEdgeCount (unsigned int ngon_index) const
 
ON_3dPoint NgonCenter (const ON_MeshNgon *ngon) const
 
ON_3dPoint NgonCenter (unsigned int ngon_index) const
 
int NgonCount () const
 
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
 
bool NormalizeTextureCoordinates ()
 
ON::object_type ObjectType () const override
 
ON_MeshOffsetMesh (const double distance, const ON_3dVector &direction) const
 
ON_Meshoperator= (const ON_Mesh &)
 
bool OrientNgons (bool bPermitHoles)
 
const ON_MeshPartitionPartition () const
 
int QuadCount () const
 number of faces that are quads More...
 
bool Read (ON_BinaryArchive &) override
 
unsigned int RemoveAllCreases ()
 
void RemoveAllNgons ()
 
void RemoveEmptyNgons ()
 
void RemoveMappingMeshInfo ()
 
bool RemoveNgon (unsigned int ngon_index)
 
bool RemoveNgonInteriorVertices (const unsigned int *const *vertex_face_map, unsigned int ngon_index0, unsigned int ngon_index1)
 
void RemoveNgonMap ()
 
unsigned int RemoveNgons (unsigned int ngon_index_count, const unsigned int *ngon_index_list)
 
bool ReserveVertexCapacity (size_t new_vertex_capacity)
 
bool ReverseSurfaceParameters (int dir)
 
bool ReverseTextureCoordinates (int dir)
 
bool SeparateNgons (unsigned int **vertex_face_map, unsigned int ngon_index0, unsigned int ngon_index1)
 
const ON_TextureCoordinatesSetCachedTextureCoordinates (const class ON_TextureMapping &mapping, const class ON_Xform *mesh_xform=0, bool bLazy=true)
 
const ON_TextureCoordinatesSetCachedTextureCoordinatesEx (const class ON_TextureMapping &mapping, const class ON_Xform *mesh_xform=0, bool bLazy=true, bool bSeamCheck=true)
 
void SetClosed (int closed)
 
bool SetCurvatureColorAnalysisColors (bool bLazy, ON_SurfaceCurvatureColorMapping kappa_colors)
 Set the mesh's per vertex colors in m_C[] from the surface principal curvatures in m_K[] More...
 
bool SetDraftAngleColorAnalysisColors (bool bLazy, ON_SurfaceDraftAngleColorMapping draft_angle_colors)
 
bool SetMappingMeshInfo (const ON_MappingMeshInfo &info)
 
void SetMeshParameters (const ON_MeshParameters &)
 
void SetNgonCount (unsigned int ngon_count)
 
bool SetNgonVertexNormals (unsigned int ngon_index0, unsigned int ngon_index1)
 
bool SetQuad (int, int, int, int, int)
 
bool SetRenderMeshInfo (const ON_RenderMeshInfo &info)
 
void SetSolidOrientation (int solid_orientation)
 
bool SetSurfaceParamtersFromTextureCoodinates ()
 
bool SetTextureCoord (int, double, double)
 
bool SetTextureCoordinates (const class ON_TextureMapping &mapping, const class ON_Xform *mesh_xform=0, bool bLazy=true)
 
bool SetTextureCoordinatesEx (const class ON_TextureMapping &mapping, const class ON_Xform *mesh_xform=0, bool bLazy=true, bool bSeamCheck=true)
 
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)
 
bool SetVertexNormal (int, const ON_3dVector &)
 
bool SetVertexNormal (int, const ON_3fVector &)
 
unsigned int SizeOf () const override
 ON_Object overrides. More...
 
int SolidOrientation () const
 
bool Split (const ON_SimpleArray< const ON_Mesh * > &meshesThatSplit, double tolerance, bool splitAtCoplanar, bool createNgons, bool *somethingHappened, ON_SimpleArray< ON_Mesh * > &results, ON_TextLog *log, ON_Terminator *cancel, ON_ProgressReporter *reporter) const
 
bool SwapCoordinates (int, int) override
 
bool SwapEdge (int topei)
 
const ON_MeshTopologyTopology () const
 
bool TopologyExists () const
 
bool Transform (const ON_Xform &) override
 
void TransformMappingMeshInfo (const ON_Xform &xform)
 
bool TransposeSurfaceParameters ()
 
bool TransposeTextureCoordinates ()
 
int TriangleCount () const
 number of faces that are triangles More...
 
bool UnitizeFaceNormals ()
 
bool UnitizeVertexNormals ()
 
void UpdateDoublePrecisionVertices ()
 
void UpdateSinglePrecisionVertices ()
 
void V4V5_DestroyNgonList ()
 
class ON_V4V5_MeshNgonList * V4V5_ModifyNgonList ()
 
const class ON_V4V5_MeshNgonList * V4V5_NgonList () const
 
ON_3dPoint Vertex (int vertex_index) const
 
int VertexCount () const
 query More...
 
bool VertexIsHidden (int meshvi) const
 
unsigned int VertexUnsignedCount () const
 
double Volume (ON_3dPoint base_point=ON_3dPoint::Origin, double *error_estimate=nullptr) const
 
ON_3dPoint VolumeCentroid (ON_3dPoint base_point=ON_3dPoint::Origin, double *volume=nullptr) const
 
bool VolumeMassProperties (class ON_MassProperties &mp, bool bVolume=true, bool bFirstMoments=true, bool bSecondMoments=true, bool bProductMoments=true, ON_3dPoint base_point=ON_3dPoint::UnsetPoint) const
 
bool Write (ON_BinaryArchive &) const override
 
- Public Member Functions inherited from ON_Geometry
 ON_Geometry ()=default
 
 ON_Geometry (const ON_Geometry &)=default
 
 ~ON_Geometry ()=default
 
ON_BoundingBox BoundingBox () const
 
virtual class ON_BrepBrepForm (class ON_Brep *brep=nullptr) const
 
virtual void ClearBoundingBox ()
 
virtual ON_COMPONENT_INDEX ComponentIndex () const
 
bool GetBoundingBox (ON_3dPoint &bbox_min, ON_3dPoint &bbox_max, bool bGrowBox=false) const
 
bool GetBoundingBox (ON_BoundingBox &bbox, bool bGrowBox=false) const
 
virtual bool HasBrepForm () const
 
virtual bool Morph (const class ON_SpaceMorph &morph)
 
ON_Geometryoperator= (const ON_Geometry &)=default
 
bool Rotate (double rotation_angle, const ON_3dVector &rotation_axis, const ON_3dPoint &rotation_center)
 
bool Rotate (double sin_angle, double cos_angle, const ON_3dVector &rotation_axis, const ON_3dPoint &rotation_center)
 
bool Scale (double scale_factor)
 
const ON_BoundingBox TightBoundingBox () const
 
bool Translate (const ON_3dVector &translation_vector)
 
- Public Member Functions inherited from ON_Object
 ON_Object () ON_NOEXCEPT
 
 ON_Object (const ON_Object &)
 
virtual ~ON_Object ()
 
virtual ON_AggregateComponentStatus AggregateComponentStatus () const
 
bool AttachUserData (class ON_UserData *pUserData)
 
unsigned int ClearAllComponentStates () const
 
virtual unsigned int ClearComponentStates (ON_COMPONENT_INDEX component_index, ON_ComponentStatus states_to_clear) const
 
virtual unsigned int ClearComponentStates (ON_ComponentStatus states_to_clear) const
 
void CopyUserData (const ON_Object &source_object)
 
unsigned int CopyUserData (const ON_Object &source_object, ON_UUID source_userdata_item_id, ON_Object::UserDataConflictResolution userdata_conflict_resolution)
 
bool DetachUserData (class ON_UserData *pUserData)
 
void EmergencyDestroy ()
 
class ON_UserDataFirstUserData () const
 
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
 
bool GetUserString (const wchar_t *key, ON_wString &string_value) const
 
int GetUserStringKeys (ON_ClassArray< ON_wString > &user_string_keys) const
 
int GetUserStrings (ON_ClassArray< ON_UserString > &user_strings) const
 
bool IsCorrupt (bool bRepair, bool bSilentError, class ON_TextLog *text_log) const
 
bool IsKindOf (const ON_ClassId *pClassId) const
 
virtual void MarkAggregateComponentStatusAsNotCurrent () const
 
virtual ON_UUID ModelObjectId () const
 
void MoveUserData (ON_Object &source_object)
 
unsigned int MoveUserData (ON_Object &source_object, ON_UUID source_userdata_item_id, ON_Object::UserDataConflictResolution userdata_conflict_resolution, bool bDeleteAllSourceItems)
 
ON_Objectoperator= (const ON_Object &)
 
void PurgeUserData ()
 
virtual unsigned int SetComponentStates (ON_COMPONENT_INDEX component_index, ON_ComponentStatus states_to_set) const
 
virtual unsigned int SetComponentStatus (ON_COMPONENT_INDEX component_index, ON_ComponentStatus status_to_copy) const
 
bool SetUserString (const wchar_t *key, const wchar_t *string_value)
 
int SetUserStrings (int count, const ON_UserString *user_strings, bool bReplace)
 
bool ThisIsNullptr (bool bSilentError) const
 
void TransformUserData (const class ON_Xform &xform)
 
virtual bool UpdateReferencedComponents (const class ON_ComponentManifest &source_manifest, const class ON_ComponentManifest &destination_manifest, const class ON_ManifestMap &manifest_map)
 
int UserStringCount () const
 

Static Public Member Functions

static ON_MeshFrom3dPolygon (const ON_SimpleArray< ON_3dPoint > &polygon_points, double planar_tolerance, ON_Mesh *destintation_mesh)
 
static ON_MeshFrom3dPolygon (size_t polygon_points_count, const ON_3dPoint *polygon_points, double planar_tolerance, ON_Mesh *destintation_mesh)
 
static ON_MeshFromFilteredFaceList (const ON_Mesh &original, bool *pattern, unsigned patternLength)
 
static bool IntersectArray (const ON_SimpleArray< const ON_Mesh * > &meshes, double tolerance, ON_SimpleArray< ON_Polyline * > *perforatingResults, ON_SimpleArray< ON_Polyline * > *overlapResults, ON_Mesh *overlapMeshResult, ON_TextLog *log, ON_Terminator *cancel, ON_ProgressReporter *reporter)
 
static bool IntersectArrayPredicate (const ON_SimpleArray< const ON_Mesh * > &meshesA, const ON_SimpleArray< const ON_Mesh * > *meshesB, ON_MeshIntersectionCache *cacheForMeshesB, double tolerance, bool *anyTypeOfIntersection, ON_SimpleArray< ON_2dex > *pairs, ON_TextLog *log, ON_Terminator *cancel, ON_ProgressReporter *reporter)
 
static bool IterativeCleanup (const ON_SimpleArray< const ON_Mesh * > &meshes, double tolerance, ON_SimpleArray< ON_Mesh * > &results)
 
static bool RequireIterativeCleanup (const ON_SimpleArray< const ON_Mesh * > &meshes, double tolerance)
 
static bool SplitArray (const ON_SimpleArray< const ON_Mesh * > &meshesToSplit, const ON_SimpleArray< const ON_Mesh * > &meshesThatSplit, double tolerance, bool splitAtCoplanar, bool createNgons, bool *somethingHappened, ON_SimpleArray< ON_Mesh * > &results, ON_TextLog *log, ON_Terminator *cancel, ON_ProgressReporter *reporter)
 

Public Attributes

ON_SimpleArray< ON_Colorm_C
 
ON_MappingTag m_Ctag
 Implementation - false color. More...
 
ON_3dPointArray m_dV
 
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
 use this to allocate elements added to m_Ngon; More...
 
ON_SimpleArray< unsigned int > m_NgonMap
 invalid if m_NgonMap.Count() != m_F.Count() More...
 
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]
 Packed texture information. More...
 
double m_srf_scale [2]
 
ON_2fPointArray m_T
 DEPRECATED. More...
 
ON_ClassArray< ON_TextureCoordinatesm_TC
 
ON_MappingTag m_Ttag
 The m_Ttag member has been DEPRECATED. Please don't use it. More...
 
ON_3fPointArray m_V
 

Static Public Attributes

static const ON_Mesh Empty
 
- Static Public Attributes inherited from ON_Geometry
const static ON_Geometry Unset
 

Protected Attributes

int m_invalid_count
 
ON_MeshCurvatureStatsm_kstat [4]
 gaussian,mean,min,max,sectionx,sectiony,sectionz More...
 
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]
 2d bounding box of all referenced texture coordinates More...
 
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
}
 

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 
)
Parameters
initial_face_array_capacityinitial face array capacity
initial_vertex_array_capacityinitial vertex array capacity
has_vertex_normalstrue if mesh has vertex normals
has_texture_coordinatestrue if mesh 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/6]

int ON_Mesh::AddNgon ( const ON_SimpleArray< unsigned int > &  ngon_fi)

Description: Add a new ngon to the mesh. Does not allow the creation of inner boundaries. Parameters: ngon_fi[] An array of distinct ON_Mesh.m_F[] face indices referencing a set of connected faces. Returns: index of the new n-gon. -1: If input information is not valid.

◆ AddNgon() [2/6]

int ON_Mesh::AddNgon ( const ON_SimpleArray< unsigned int > &  ngon_fi,
bool  bPermitHoles 
)

Description: Add a new ngon to the mesh. Parameters: ngon_fi[] An array of distinct ON_Mesh.m_F[] face indices referencing a set of connected faces. bPermitHoles If true, also ngons that contain inner boundaries are allowed. Returns: index of the new n-gon. -1: If input information is not valid.

◆ AddNgon() [3/6]

unsigned int ON_Mesh::AddNgon ( ON_MeshNgon ngon)

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

◆ AddNgon() [4/6]

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

Description: Add a new ngon to the mesh. Does not allow the creation of inner boundaries. Parameters: Fcount - [in] Number of face that make up the ngon. ngon_fi[] An array of N distinct ON_Mesh.m_F[] face indices referencing a set of connected faces. Returns: index of the new n-gon. -1: If input information is not valid.

◆ AddNgon() [5/6]

int ON_Mesh::AddNgon ( unsigned int  Fcount,
const unsigned int *  ngon_fi,
bool  bPermitHoles 
)

Description: Add a new ngon to the mesh. Parameters: Fcount - [in] Number of face that make up the ngon. ngon_fi[] An array of N distinct ON_Mesh.m_F[] face indices referencing a set of connected faces. bPermitHoles If true, also ngons that contain inner boundaries are allowed. Returns: index of the new n-gon. -1: If input information is not valid.

◆ AddNgon() [6/6]

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

Description: Add a new ngon to the mesh. Parameters: Vcount - number 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_Expert()

int ON_Mesh::AddNgon_Expert ( unsigned int  Fcount,
const unsigned int *  ngon_fi,
bool  bPermitHoles,
ON_MeshVertexFaceMap vertexFaceMap 
)

Description: Add a new ngon to the mesh. WARNING! The usage of this particular overload is discouraged unless its usage is critical for performance. If vertexFaceMap is set to something other than nullptr, then the value will be filled and can be re-fed to the function. Parameters: Fcount - [in] Number of face that make up the ngon. ngon_fi[] An array of N distinct ON_Mesh.m_F[] face indices referencing a set of connected faces. bPermitHoles If true, also ngons that contain inner boundaries are allowed. faceVertexMap If nullptr, this will be set to a new faceVertexMap. Must be freed with onfree(). It is responsibility of the user to call onfree() on the created object. Returns: index of the new n-gon. -1: If input information is not valid.

◆ AddNgons()

unsigned int ON_Mesh::AddNgons ( const ON_SimpleArray< ON_COMPONENT_INDEX > &  ci_list)

◆ 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 
)

Description: 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 n-gon must be within planar_tolerance of the plane defined by the first face in the n-gon. minimum_ngon_vertex_count - [in] n-gons must have at least this many sides in order to be added. minimum_ngon_face_count - [in] n-gons 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 
)

Description: 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/3]

void ON_Mesh::Append ( const ON_Mesh )

appends a copy of mesh to this and updates indices of appended mesh parts

◆ Append() [2/3]

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

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

◆ Append() [3/3]

void ON_Mesh::Append ( std::vector< std::shared_ptr< const ON_Mesh >>  )

Description: Append a vector 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: meshes - [in] vector of meshes to append.

◆ AppendDuplicateVertex()

unsigned int ON_Mesh::AppendDuplicateVertex ( unsigned int  vertex_index)

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

◆ Area()

double ON_Mesh::Area ( double *  error_estimate = nullptr) const

Description: Compute area of the mesh. Parameters: error_estimate - [out] if not nullptr, an upper bound on the error in the area calculation is returned. Example:

      ON_Mesh mesh = ...;
      double area, error_estimate;
      area = mesh.Area(&error_estimate);
      printf("mesh area = %g (+/- %g)\n",area,error_estimate);

Returns: Area of the mesh.

◆ AreaCentroid()

ON_3dPoint ON_Mesh::AreaCentroid ( double *  area = nullptr) const

Description: Compute area centroid of the mesh. Parameters: area - [out] it not nullptr, area of the mesh Returns: Location of area centroid. See Also: ON_Mesh::AreaMassProperties

◆ AreaMassProperties()

bool ON_Mesh::AreaMassProperties ( class ON_MassProperties mp,
bool  bArea = true,
bool  bFirstMoments = true,
bool  bSecondMoments = true,
bool  bProductMoments = true 
) const

Description: Calculate area mass properties of the mesh. Parameters: mp - [out] bArea - [in] true to calculate area bFirstMoments - [in] true to calculate area first moments, area and area centroid. bSecondMoments - [in] true to calculate area second moments. bProductMoments - [in] true to calculate area product moments. Returns: True if successful.

◆ CachedTextureCoordinates()

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

◆ Cleanup() [1/2]

void ON_Mesh::Cleanup ( bool  bRemoveNgons)

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

◆ Cleanup() [2/2]

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

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

◆ ClearVertexColors()

void ON_Mesh::ClearVertexColors ( )

◆ CollapseEdge()

bool ON_Mesh::CollapseEdge ( int  topei)

mesh editing Description: 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 
)

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

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

◆ ComputeFaceNormal()

bool ON_Mesh::ComputeFaceNormal ( int  )

computes face normal of indexed face

◆ ComputeFaceNormals()

bool ON_Mesh::ComputeFaceNormals ( )

compute face normals for all faces

◆ ComputeVertexNormals()

bool ON_Mesh::ComputeVertexNormals ( )

uses face normals to cook up a vertex normal

◆ ConvertNonPlanarQuadsToTriangles() [1/2]

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

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

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.

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 ( )

Description: Splits all quads along the short diagonal.

◆ ConvertTrianglesToQuads()

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

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

Description: Copy the subset of the mesh identified 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: null - invalid 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

Description: Copy the subset of the mesh identified 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: null - invalid input - no copy created not null - a pointer to the copy.

◆ CountQuads()

bool ON_Mesh::CountQuads ( )

◆ CreateNgonMap() [1/3]

const unsigned int* ON_Mesh::CreateNgonMap ( )

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

◆ CreateNgonMap() [2/3]

bool ON_Mesh::CreateNgonMap ( ON_SimpleArray< unsigned int > &  map) const

Description: Expert user function to construct n-gon map even on const objects after the expert user did something that made the current one invalid. map [out]: The map is modified to match the new ngon map, if true is returned. Returns: A value indicating if the mesh has ngon information. The map is 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.

◆ CreateNgonMap() [3/3]

bool ON_Mesh::CreateNgonMap ( unsigned int *  ngon_map) const

Description: Expert user function to construct n-gon map even on const objects after the expert user did something that made the current one invalid. map [in-out]: The map must have at least m_F elements It is modified to match the new ngon map, if true is returned. Returns: A value indicating if the mesh has ngon information. The map is 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   
)

mesh partitions

In ancient times, some rendering engines were only able to process small batches of triangles and th CreatePartition() function was provided to partition the mesh into subsets of vertices and faces that those renering engines could handle.

◆ CullClashingFaces()

int ON_Mesh::CullClashingFaces ( int  what_to_cull)

Description: 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. Remarks: 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 ( )

returns number of degenerate faces

◆ CullDegenerates()

unsigned int ON_Mesh::CullDegenerates ( )

Description: Removes degenerate and unused mesh components. Returns: Number of removed components;

◆ CullUnusedVertices()

int ON_Mesh::CullUnusedVertices ( )

returns number of culled vertices

◆ 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)

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

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

◆ DeleteComponents() [1/4]

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

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

Reimplemented from ON_Object.

◆ DeleteComponents() [2/4]

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

Description: 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: successful False: failure - no changes.

◆ DeleteComponents() [3/4]

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

Description: 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. faceMap - [i] If anything other than nullptr is passed in, then faceMap[fi] is the index of the new face after the removal of vertices, faces, etc. This needs to be allocated to be at least m_F.Count() long. Returns: True: successful False: failure - no changes.

◆ DeleteComponents() [4/4]

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

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

Description: 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 Remarks: This function calls DestroyTopology() and DestroyPartition(). The caller is responsible for calling Compact() if that step is required. Returns: true if successful

◆ DeleteMeshParameters()

void ON_Mesh::DeleteMeshParameters ( )

◆ Destroy()

void ON_Mesh::Destroy ( )

◆ DestroyDoublePrecisionVertices()

void ON_Mesh::DestroyDoublePrecisionVertices ( )

Description: The function removes all double precision vertex information.

◆ DestroyHiddenVertexArray()

void ON_Mesh::DestroyHiddenVertexArray ( )

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

If you modify the mesh in any way that may change its topology, then call DestroyTopology(). Specifically if you add or remove vertices or face, change vertex locations, or change the face m_vi[] values, then you must call DestroyTopology().

◆ DestroyTree()

void ON_Mesh::DestroyTree ( bool  bDeleteTree = true)

◆ Dimension()

int ON_Mesh::Dimension ( ) const
overridevirtual

ON_Geometry overrides.

Reimplemented from ON_Geometry.

◆ DissolveOrDelete()

unsigned int ON_Mesh::DissolveOrDelete ( const ON_SimpleArray< ON_COMPONENT_INDEX > &  ci_list)

Description: Merge faces like ON_SubD::MergeFaces() does. Parameters: ci_list - [in] vertices, edges, and faces that trigger merging. Returns: If ngons were added, then the index of the first added ngon is returned. Otherwise ON_UNSET_UINT_INDEX is returned.

◆ DoublePrecisionVertices() [1/2]

ON_3dPointArray& ON_Mesh::DoublePrecisionVertices ( )

Implementation - mesh geometry.

Vertex locations In a case where adjacent facets share a vertex location but have distinct normals or texture coordinates at that location, the vertex must be duplicated. Description: 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(). Example:

/ 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 precision values / in m_V[] and sets all the counts and CRCs that / are used in validity checking. mesh.UpdateSinglePrecisonVertices();

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

◆ DoublePrecisionVertices() [2/2]

const ON_3dPointArray& ON_Mesh::DoublePrecisionVertices ( ) const

◆ Dump()

void ON_Mesh::Dump ( ON_TextLog ) const
overridevirtual

for debugging

Reimplemented from ON_Object.

◆ DuplicateBorder()

bool ON_Mesh::DuplicateBorder ( ON_SimpleArray< ON_Polyline * > &  polylines,
bool  joinOverUnweldedVertices 
) const

Description: Finds the naked border of a mesh. Parameters: polylines - [in] An array to which objects will be added. joinOverUnweldedVertices - [in] If true, unwelded vertices will stop the polyline. Returns: true if the computation finished successfully, false otherwise.

◆ DuplicateFace()

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

Description: Create a mesh that is a single face of this mesh. Parameters: 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 ( )

Call only when memory used by this class's members will soon become invalid for reasons beyond your control. EmergencyDestroy() zeros anything that could possibly cause ~ON_Mesh() to crash. Calling EmergencyDestroy() under normal conditions will result in ~ON_Mesh() leaking memory.

◆ EvaluateMeshGeometry()

bool ON_Mesh::EvaluateMeshGeometry ( const ON_Surface )

evaluate surface at tcoords to set mesh geometry

◆ 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

Description: 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. Remarks: 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 ( )

reverses face orientations and flips vertex and face normals

◆ FlipFaceNormals()

void ON_Mesh::FlipFaceNormals ( )

reverses face normals

◆ FlipFaceOrientation()

void ON_Mesh::FlipFaceOrientation ( )

reverses face orientation (does nothing to normals)

◆ FlipNgonOrientation()

void ON_Mesh::FlipNgonOrientation ( )

reverses ngon boundary direction

◆ FlipVertexNormals()

void ON_Mesh::FlipVertexNormals ( )

reverses vertex normals

◆ From3dPolygon() [1/2]

static ON_Mesh* ON_Mesh::From3dPolygon ( const ON_SimpleArray< ON_3dPoint > &  polygon_points,
double  planar_tolerance,
ON_Mesh destintation_mesh 
)
static

◆ From3dPolygon() [2/2]

static ON_Mesh* ON_Mesh::From3dPolygon ( size_t  polygon_points_count,
const ON_3dPoint polygon_points,
double  planar_tolerance,
ON_Mesh destintation_mesh 
)
static

Description: Create a mesh that fills in a 3d polygon. Parameters: polygon_points_count - [in] >= 3 polygon_points - [in] An array of distinct 3d points that forms a polygon. The points do not have to be coplanar, but they should be close to coplanar if you want a decent result. planar_tolerance - [in] If planar_tolerance >= 0.0 and polygon_points >= 4, then planar_tolerance is a 3d distance tolerance use to determine if the polygon is planar. When a polygon is planar, all vertex normals are identical. When a polygon is not planar, vertex normals may vary. If planar_tolerance is not >= 0.0, then all vertex normals are identical in all cases. destintation_mesh - [in] null or a pointer to the mesh to be used. Returns: A pointer to a mesh that fills the 3d polygon or null if the input is not valid.

◆ FromFilteredFaceList()

static ON_Mesh* ON_Mesh::FromFilteredFaceList ( const ON_Mesh original,
bool *  pattern,
unsigned  patternLength 
)
static

Description: Create a mesh from a filtered mesh list. Parameters: original - [in] a mesh input pattern - [in] An array of boolean values. patternLength - [in] Length of pattern. Returns: A pointer to a mesh that is the result, or nullptr.

◆ 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

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

◆ GetClosestPoint()

bool ON_Mesh::GetClosestPoint ( const ON_3dPoint P,
class ON_MESH_POINT Q,
double  maximum_distance = 0.0 
) const

Description: Get the point on the mesh that is closest to P. Parameters: P - [in] test point Q - [out] point on the mesh maximum_distance = 0.0 - [in] optional upper bound on the distance from P to the mesh. If you are only interested in finding a point Q on the mesh when P.DistanceTo(Q) < maximum_distance, then set maximum_distance to that value. Returns: True if successful. If false, the value of Q is undefined.

◆ GetConnectedComponents() [1/2]

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

mesh components ON_Mesh objects can consist of sets of faces that are isolated from any other sets of faces. The following 2 functions will dissect a mesh into these sets, called components. Not to be confused with ON_COMPONENT_INDEX. Description: 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 components. 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

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

◆ GetIntersections() [1/2]

bool ON_Mesh::GetIntersections ( const ON_SimpleArray< const ON_Mesh * > &  withTheseOtherMeshes,
double  tolerance,
ON_SimpleArray< ON_Polyline * > *  perforatingResults,
ON_SimpleArray< ON_Polyline * > *  overlapResults,
ON_Mesh overlapMeshResult,
ON_TextLog log,
ON_Terminator cancel,
ON_ProgressReporter reporter 
) const

Get intersections with the current mesh. Intersections between other meshes are ignored. See the parameter description in the function above.

◆ GetIntersections() [2/2]

bool ON_Mesh::GetIntersections ( const ON_SimpleArray< const ON_Mesh * > &  withTheseOtherMeshes,
ON_MeshIntersectionCache cacheForOtherMeshes,
double  tolerance,
ON_SimpleArray< ON_Polyline * > *  perforatingResults,
ON_SimpleArray< ON_Polyline * > *  overlapResults,
ON_Mesh overlapMeshResult,
ON_TextLog log,
ON_Terminator cancel,
ON_ProgressReporter reporter 
) const

Get intersections with the current mesh. Intersections between other meshes are ignored. See the parameter description in the function above.

cacheForOtherMeshes [in/out] - Users of this class can provide nullptr, or call this method with a default-initialized instance of ON_MeshIntersectionCache. In this case, the cache can be used with other calls of this function that include exactly withTheseOtherMeshes.

◆ GetMappingMeshInfo()

const ON_MappingMeshInfo* ON_Mesh::GetMappingMeshInfo ( ) const

◆ GetMeshEdgeList() [1/6]

unsigned int ON_Mesh::GetMeshEdgeList ( ON_SimpleArray< ON_2dex > &  edge_list,
bool  bLookForNgonInteriorEdges,
bool  bOmitHiddenEdges,
ON_SimpleArray< int > &  ci_meshtop_edge_map,
ON_SimpleArray< int > &  ci_meshtop_vertex_map,
unsigned int  edge_type_partition[6] 
) const

◆ GetMeshEdgeList() [2/6]

unsigned int ON_Mesh::GetMeshEdgeList ( ON_SimpleArray< ON_2dex > &  edge_list,
bool  bLookForNgonInteriorEdges,
bool  bOmitHiddenEdges,
ON_SimpleArray< int > &  ci_meshtop_edge_map,
unsigned int  edge_type_partition[6] 
) const

◆ GetMeshEdgeList() [3/6]

unsigned int ON_Mesh::GetMeshEdgeList ( ON_SimpleArray< ON_2dex > &  edge_list,
bool  bLookForNgonInteriorEdges,
bool  bOmitHiddenEdges,
unsigned int  edge_type_partition[6] 
) const

◆ GetMeshEdgeList() [4/6]

unsigned int ON_Mesh::GetMeshEdgeList ( ON_SimpleArray< ON_2dex > &  edge_list,
bool  bLookForNgonInteriorEdges,
ON_SimpleArray< int > &  ci_meshtop_edge_map,
ON_SimpleArray< int > &  ci_meshtop_vertex_map,
unsigned int  edge_type_partition[6] 
) const

◆ GetMeshEdgeList() [5/6]

unsigned int ON_Mesh::GetMeshEdgeList ( ON_SimpleArray< ON_2dex > &  edge_list,
bool  bLookForNgonInteriorEdges,
ON_SimpleArray< int > &  ci_meshtop_edge_map,
unsigned int  edge_type_partition[6] 
) const

◆ GetMeshEdgeList() [6/6]

unsigned int ON_Mesh::GetMeshEdgeList ( ON_SimpleArray< ON_2dex > &  edge_list,
bool  bLookForNgonInteriorEdges,
unsigned int  edge_type_partition[6] 
) const

Description: Get a list of the geometrically uniqued edges in a mesh. Parameters: edge_list - [out] The edge list for this mesh is appended to edge_list[].
The ON_2dex i and j values are mesh->m_V[] array indices. There is exactly one element in edge_list[] for each unoriented 3d line segment in the mesh. The edges are oriented the same way the corresponding ON_MeshTopology edge is oriented. bLookForNgonInteriorEdges - [in] true if ngon interior edges should be separated from manifold edges. bOmitHiddenEdges - [in] true if edges that have at least one hidden vertex should be omitted from the returned lists. ci_meshtop_edge_map - [out] If you call the version of GetMeshEdgeList() with the ci_meshtop_edge_map[], parameter, then the edge in edge_list[i] corresponds to the edge in ON_MeshTopology.m_tope[ci_meshtop_edge_map[i]]. The value ci_meshtop_edge_map[i] is useful if you need to convert an edge_list[] index into an ON_COMPONENT_INDEX with type meshtop_edge. ci_meshtop_vertex_map - [out] If you call the version of GetMeshEdgeList() with the ci_meshtop_vertex_map[], parameter, then the vertex m_V[i] corresponds to the vertex in ON_MeshTopology.m_topv[ci_meshtop_vertex_map[i]]. The value ci_meshtop_vertex_map[i] is useful if you need to convert an m_V[] index into an ON_COMPONENT_INDEX with type meshtop_vertex. edge_list_partition - [out] (can be null) The edge_list[] is always ordered so that edge_types are partitioned into contiguous regions. The edge_list_partition[5] values report the edge type regions. If edge_type_partition[0] <= ei < edge_type_partition[1], then edge_list[ei] is an edge of exactly two faces and the vertices used by the faces are identical. These are also called "manifold edges". If edge_type_partition[1] <= ei < edge_type_partition[2], then edge_list[ei] is an edge of exactly two faces, but at least one of the vertices is duplicated. These are also called "crease edges". If edge_type_partition[2] <= ei < edge_type_partition[3], then edge_list[ei] is an edge of 3 or more faces. These are also called "nonmanifold edges". If edge_type_partition[3] <= ei < edge_type_partition[4], then edge_list[ei] is a boundary edge of exactly one mesh face. These are also called "naked edges". If edge_type_partition[4] <= ei < edge_type_partition[5], then edge_list[ei] is an edge of exactly two faces that belong to the same ngon. These are also called "ngon interior edges". faceSidesList - [out] (can be null) fills the array with sides, ordered by vertex index. This can be thought as a reverse face-vertex map. This is required by any internal calculations. Returns: Number of edges added to edge_list[]. Remarks: This calculation also sets m_closed. If you modify the mesh's m_V or m_F information after calling this function, be sure to clear m_is_closed.

◆ GetMeshEdges()

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

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

Description: 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 possible 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[]. Remarks: 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.

◆ GetMeshNakedEdgeList()

unsigned int ON_Mesh::GetMeshNakedEdgeList ( ON_SimpleArray< ON_2dex > &  naked_edge_list,
ON_SimpleArray< int > *  ci_meshtop_vertex_map = nullptr,
bool  bLookForNgonInteriorEdges = false 
) const

◆ GetMeshNakedEdgeListEx()

unsigned int ON_Mesh::GetMeshNakedEdgeListEx ( ON_SimpleArray< ON_2dex > &  naked_edge_list,
ON_SimpleArray< int > *  ci_meshtop_vertex_map = nullptr,
bool  bLookForNgonInteriorEdges = false,
ON_SimpleArray< ON_MeshFaceSide > *  faceSides = nullptr 
) const

◆ GetNgonBoundaryPoints() [1/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.

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

◆ GetNgonOuterBoundary()

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

Description: Given a group of connected coplanar faces, find the n-gon boundary. ngon_fi_count - [in] number of indices in ngon_fi[] ngon_fi - [in] Indices of faces in the ON_Mesh.m_F[] array. ngon_vi - [out] An ordered list of indices of vertices in the ON_Mesh.m_V[] array that for the outer boundary of the n-gon. The natural counter-clockwise orientation of the first face with a boundary edge determines the order of the ngon_vi[] list.

◆ GetRenderMeshInfo()

const ON_RenderMeshInfo* ON_Mesh::GetRenderMeshInfo ( ) const

◆ GetSelfIntersections()

bool ON_Mesh::GetSelfIntersections ( double  tolerance,
ON_SimpleArray< ON_Polyline * > *  perforatingResults,
ON_SimpleArray< ON_Polyline * > *  overlapResults,
ON_Mesh overlapMeshResult,
ON_TextLog log,
ON_Terminator cancel,
ON_ProgressReporter reporter 
) const

Get self intersections on the current mesh. See the parameter description in the function above.

◆ GetSilhouette()

bool ON_Mesh::GetSilhouette ( const ON_SilhouetteParameters  parameters,
const ON_PlaneEquation clipping_planes,
size_t  clipping_plane_count,
ON_ClassArray< ON_SIL_EVENT > &  silhouettes,
ON_ProgressReporter progress,
ON_Terminator terminator 
) 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

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

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

Double precision vertex support 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() [1/2]

bool ON_Mesh::HasVertexColors ( ) const
Returns
If this mesh has per vertex colors set in the m_C[] array, then true is returned. Otherwise false is returned. /returns>

◆ HasVertexColors() [2/2]

bool ON_Mesh::HasVertexColors ( ON_MappingTag  color_tag) const
Parameters
color_tag
Returns
If this mesh has per vertex colors set in the m_C[] array and color_tag = m_Ctag, then true is returned. Otherwise false is returned.

◆ HasVertexNormals()

bool ON_Mesh::HasVertexNormals ( ) const

normals at vertices

◆ 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 
)

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

◆ IntersectArray()

static bool ON_Mesh::IntersectArray ( const ON_SimpleArray< const ON_Mesh * > &  meshes,
double  tolerance,
ON_SimpleArray< ON_Polyline * > *  perforatingResults,
ON_SimpleArray< ON_Polyline * > *  overlapResults,
ON_Mesh overlapMeshResult,
ON_TextLog log,
ON_Terminator cancel,
ON_ProgressReporter reporter 
)
static

Description: Intersects a group of meshes. This method uses the new code. Parameters: meshes - [in] The mesh input list. nullptr entries are tolerated. tolerance - [in] A 3d-distance tolerance value. If tolerance is:

  • negative: the positive value will be used.
  • 0.0: no tolerance will be used. This is rarely useful, and only in cases where perforations intersections happen inside faces, and/or there is coplanarity parallel to one of the three fundamental axes.
  • ON_DBL_QNAN, ON_UNSET_VALUE and ON_UNSET_POSITIVE_VALUE: the function picks a suitable, or default, tolerance value. WARNING! Generally, good tolerance values for objects drawn near the origin are in the magnitude of 10^-7, or ON_SQRT_EPSILON * 10. Often, the document absolute tolerance is not a good tolerance value. You might use a fractional coefficient to scale the document tolerance to a suitable value, while accepting a user-provided value. This function expects that each mesh conforms to the tolerance that is provided, and that means that features in the mesh are always larger than the mentioned tolerance. Coplanar gaps between meshes that are smaller than tolerance are overlaps. perforatingResults - [out] If not nullptr, this array will be filled with the polylines from perforating intersections. overlapResults - [out] If not nullptr, this array will be filled with the polylines from overlaps. This can be (but does not need to be) the same object provided to intersectionResults. overlapMeshResult - [out] If not nullptr, this mesh will have new faces added that represent the coplar unions of inputs. If this output is not required, it's best to leave this as nullptr. log - [out] If not nullptr, intersection warnings and errors are printed here. If the intersection runs smoothly, nothing will generally be printed. cancel - [out] If not nullptr, a trigger to request termination. When cancellation is requested, the return value will often be false. You are responsible to delete new objects that were returned, even if you requested cancellation. reporter - [out] If not nullptr, an indicative progress is reported. Returns: true if the computation finished successfully, false otherwise.

◆ IntersectArrayPredicate()

static bool ON_Mesh::IntersectArrayPredicate ( const ON_SimpleArray< const ON_Mesh * > &  meshesA,
const ON_SimpleArray< const ON_Mesh * > *  meshesB,
ON_MeshIntersectionCache cacheForMeshesB,
double  tolerance,
bool *  anyTypeOfIntersection,
ON_SimpleArray< ON_2dex > *  pairs,
ON_TextLog log,
ON_Terminator cancel,
ON_ProgressReporter reporter 
)
static

Description: Return information on intersections and overlaps for a group of meshes. This method uses the new code.

anyTypeOfIntersection - [in] if provided, it will be set to true if any mesh perforates another or overlaps - or nullptr. pairs - [in] if provided, a list of pairs of mesh indices that intersect or overlap. Each pair appears once only - or nullptr.

See the parameter description in the function above.

◆ IntersectMesh() [1/2]

int ON_Mesh::IntersectMesh ( const ON_Mesh meshB,
ON_ClassArray< ON_SimpleArray< ON_MMX_POINT > > &  x,
double  intersection_tolerance = 0.0,
double  overlap_tolerance = 0.0 
) const

Description: Slowly intersect this mesh with meshB. This method uses the old code. Parameters: meshB - [in] x - [out] Each element of x is a polyline of ON_MMX_POINTs. intersection_tolerance - [in] overlap_tolerance - [in] Returns: number of olylines appended to x[] array. Remarks: The InstersectMesh function will will create a meshtree, a mesh topology and face normals of this mesh and meshB. Note: if you create these in multiple memory pools you run the risk of crashing or leaking memory if you are not careful.

◆ IntersectMesh() [2/2]

int ON_Mesh::IntersectMesh ( const ON_Mesh meshB,
ON_SimpleArray< ON_Line > &  lines 
) const

Description: Quickly intersect this mesh with meshB. Ignore overlaps and near misses. Parameters: meshB - [in] lines - [out] Intersection lines are appended to this list. Returns: number of lines appended to lines[] array. Remarks: The InstersectMesh function will will create a meshtree, a mesh topology and face normals of this mesh and meshB. Note: if you create these in multiple memory pools you run the risk of crashing or leaking memory if you are not careful.

◆ IntersectPlane() [1/2]

int ON_Mesh::IntersectPlane ( ON_PlaneEquation  plane_equation,
double  tolerance,
ON_SimpleArray< ON_Polyline * > *  perforations,
ON_SimpleArray< ON_Polyline * > *  overlaps,
ON_MeshIntersectionCache cache = nullptr 
) const

Description: Intersect this mesh with an infinite plane. This uses the new codebase as of Rhino 7.16. Parameters: plane_equation - [in] tolerance - [in]- see remarks at GetIntersections() function. Use a suitably small value. perforations - [out] intersection polylines are appended if not nullptr. overlaps - [out] intersection polylines are appended if not nullptr. cache_for_this_mesh - [in-out] if a constructed instance of a cache is passed then it can be used in subsequent calls. Returns: number of lines appended to perforations[] and overlaps[] arrays.

◆ IntersectPlane() [2/2]

int ON_Mesh::IntersectPlane ( ON_PlaneEquation  plane_equation,
ON_SimpleArray< ON_Line > &  lines 
) const

Description: Intersect this mesh with an infinite plane. This uses the new codebase as of Rhino 7.16. Parameters: plane_equation - [in] lines - [out] Intersection lines are appended to this list. Returns: number of lines appended to lines[] array.

◆ InvalidateBoundingBoxes()

void ON_Mesh::InvalidateBoundingBoxes ( )

directly manipulating the m_T[] array.

Invalidates all cached bounding box information.

◆ InvalidateCachedTextureCoordinates()

void ON_Mesh::InvalidateCachedTextureCoordinates ( bool  bOnlyInvalidateCachedSurfaceParameterMapping = false)

Description: Invalidates all cached texture coordinates. Call this function when you have made changes that will affect the texture coordinates on the mesh. Parameters: bOnlyInvalidateCachedSurfaceParameterMapping - [in] If true then only cached surface parameter mapping texture coordinates will be invalidated. Use this after making changes to the m_S array.

◆ InvalidateCurvatureStats()

void ON_Mesh::InvalidateCurvatureStats ( )

directly manipulating the m_T[] array.

Call if defining geometry is changed by

◆ InvalidateTextureCoordinateBoundingBox()

void ON_Mesh::InvalidateTextureCoordinateBoundingBox ( )

directly manipulating the m_N[] array.

Call if defining geometry is changed by

◆ InvalidateVertexBoundingBox()

void ON_Mesh::InvalidateVertexBoundingBox ( )

Call if defining geometry is changed by

◆ InvalidateVertexNormalBoundingBox()

void ON_Mesh::InvalidateVertexNormalBoundingBox ( )

directly manipulating the m_V[] array.

Call if defining geometry is changed by

◆ InvalidFaceCount()

int ON_Mesh::InvalidFaceCount ( ) const

number of face that have invalid m_vi[] values.

◆ IsClosed()

bool ON_Mesh::IsClosed ( ) const

Returns: True if every mesh "edge" has two or more faces.

◆ IsCorrupt()

bool ON_Mesh::IsCorrupt ( bool  bRepair,
bool  bSilentError,
class ON_TextLog text_log 
) const

Description: Check for corrupt data values that are likely to cause crashes. Parameters: bRepair - [in] If true, const_cast<> will be used to change the corrupt data so that crashes are less likely. bSilentError - [in] If true, ON_ERROR will not be called when corruption is detected. text_log - [out] If text_log is not null, then a description of corruption is printed using text_log. Remarks: Ideally, IsCorrupt() would be a virtual function on ON_Object, but doing that at this point would break the public SDK.

◆ IsDeformable()

bool ON_Mesh::IsDeformable ( ) const
overridevirtual

virtual ON_Geometry::IsDeformable() override

Reimplemented from ON_Geometry.

◆ IsEmpty()

bool ON_Mesh::IsEmpty ( ) const

Interface Returns true if there are zero vertices or zero faces.

◆ 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

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

◆ IsMorphable()

bool ON_Mesh::IsMorphable ( ) const
overridevirtual

virtual ON_Geometry override

Reimplemented from ON_Geometry.

◆ IsNotEmpty()

bool ON_Mesh::IsNotEmpty ( ) const

Returns true if there are vertices and 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

Description: Determine if a point is inside a solid brep. Parameters: 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. Remarks: 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

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

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

Description: 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 low-level debugging purposes by programmers and is not intended to be useful as a high level user interface tool. Returns: @untitled 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

Returns: true if the n-gon information is valid for adding an n-gon to this mesh. Parameters: Vcount - [in] Number of vertices and sides in the n-gon. ngon_vi - [in]

◆ IterativeCleanup()

static bool ON_Mesh::IterativeCleanup ( const ON_SimpleArray< const ON_Mesh * > &  meshes,
double  tolerance,
ON_SimpleArray< ON_Mesh * > &  results 
)
static

Description: Performs the maximum currently-available iterative cleanup based on a tolerance value on a group of meshes. This is an iterative process. Parameters: meshes - [in] A group of meshes that are worked on together. A single mesh is also OK. tolerance - [in] A 3d distance. This is usually a value of about 10e-7 magnitude. results - [out] A list that will be filled the exactly mesh.Count() items. If a mesh did not require cleanup, or cleanup did not yield any change, a nullptr is added to this list. Returns: true if the operation was successful, false otherwise. Also returning all nullptr is considered success.

◆ 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.

◆ MergeFaceSets()

unsigned int ON_Mesh::MergeFaceSets ( const ON_SimpleArray< ON_COMPONENT_INDEX > &  ci_list)

Description: Merge faces like ON_SubD::MergeFaces() does. Parameters: ci_list - [in] vertices, edges, and faces that trigger merging. Returns: If ngons were added, then the index of the first added ngon is returned. Otherwise ON_UNSET_UINT_INDEX is returned.

◆ 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

◆ MeshFaceTree()

const class ON_RTree* ON_Mesh::MeshFaceTree ( bool  bCreateIfNoneExists) const

Parameters: bCreateIfNoneExists - [in] If a mesh face rtree is not cached on this mesh and bCreateIfNoneExists is true, then a new one will be created and cached. If a mesh face rtree is not cached on this mesh and bCreateIfNoneExists is false, then null is returned. Returns: An ON_Rtree with 3d node boxes and mesh face indices as the element id values. The pointer may be null and the caller must check it before dereferencing.

◆ MeshParameters()

const ON_MeshParameters* ON_Mesh::MeshParameters ( ) const

◆ MeshPart()

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

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

◆ MeshTree() [1/2]

const class ON_MeshTree* ON_Mesh::MeshTree ( ) const

Parameters: bCreateIfNoneExists - [in] If a mesh tree is not cached on this mesh and bCreateIfNoneExists is true, then a new one will be created and cached. If a mesh tree is not cached on this mesh and bCreateIfNoneExists is false, then null is returned. Returns: An pointer ON_MeshTree for this mesh. The pointer may be null and the caller must check it before dereferencing.

Deprecated:
Call MeshTree(true)

◆ MeshTree() [2/2]

const class ON_MeshTree* ON_Mesh::MeshTree ( bool  bCreateIfNoneExists) const

◆ ModifyNgon() [1/2]

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

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

◆ Morph()

bool ON_Mesh::Morph ( const ON_SpaceMorph morph)
override

virtual ON_Geometry override

◆ Ngon()

const ON_MeshNgon* ON_Mesh::Ngon ( unsigned int  ngon_index) const

Parameters: ngon_index - [in] Index of an ngon. Returns: A pointer to the indexed n-gon or null if the indexed ngon is null or ngon_index is out of range. Remarks: 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 ( const ON_MeshNgon ngon) const

Returns: Bounding box of the n-gon vertex locations.

◆ NgonBoundaryBoundingBox() [2/2]

ON_BoundingBox ON_Mesh::NgonBoundaryBoundingBox ( unsigned int  ngon_index) 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 ( const ON_MeshNgon ngon) const

Returns: Average of the n-gon vertex locations.

◆ NgonCenter() [2/2]

ON_3dPoint ON_Mesh::NgonCenter ( unsigned int  ngon_index) const

Returns: Average of the n-gon vertex locations.

◆ NgonCount()

int ON_Mesh::NgonCount ( ) const

N-gon

An n-gon is a collection of faces that are grouped together. The outer boundary of the face collection must be a closed polyline. N-gon interface 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(). Remarks: 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 ( )

Scales textures so the texture domains are [0,1] and eliminates any texture rotations.

◆ ObjectType()

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

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

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

Reimplemented from ON_Object.

◆ OffsetMesh()

ON_Mesh* ON_Mesh::OffsetMesh ( const double  distance,
const ON_3dVector direction 
) const

Mesh offset Description: Offsets a mesh by the input distance

distance - [in] Distance to offset direction - [in] If this parameter is ON_3dVector::UnsetVector, offset each vertex in the normal direction orherwise, offset every vertex in the input direction Returns: New mesh that is an offset of a duplicate of this mesh Or nullptr if the input was invalid or the mesh could not be duplicated or offset Caller manages memory of new mesh

◆ operator=()

ON_Mesh& ON_Mesh::operator= ( const ON_Mesh )

◆ OrientNgons()

bool ON_Mesh::OrientNgons ( bool  bPermitHoles)

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

number of faces that are quads

◆ Read()

bool ON_Mesh::Read ( ON_BinaryArchive binary_archive)
overridevirtual

Description: Low level archive writing tool used by ON_BinaryArchive::ReadObject(). Parameters: binary_archive - archive to read from Returns: Returns true if the read is successful. Remarks: 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.

◆ RemoveAllCreases()

unsigned int ON_Mesh::RemoveAllCreases ( )

◆ RemoveAllNgons()

void ON_Mesh::RemoveAllNgons ( )

Description: Remove all entries from the ON_Mesh n-gon list. Remarks: Same as SetNgonCount(0)

◆ RemoveEmptyNgons()

void ON_Mesh::RemoveEmptyNgons ( )

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

◆ RemoveMappingMeshInfo()

void ON_Mesh::RemoveMappingMeshInfo ( )

◆ RemoveNgon()

bool ON_Mesh::RemoveNgon ( unsigned int  ngon_index)

Description: Remove an n-gon. Parameters: ngon_index - [in] Returns: True if ngon_index was valid and the corresponding n-gon was removed. Remarks: 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 
)

Description: 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. Remarks: 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 ( )

Description: Expert user function to delete n-gon map information but leave n-gon definition information unchanged. Description: 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 
)

◆ RequireIterativeCleanup()

static bool ON_Mesh::RequireIterativeCleanup ( const ON_SimpleArray< const ON_Mesh * > &  meshes,
double  tolerance 
)
static

Description: Determines if meshes require an iterative cleanup based on a tolerance value. All available cleanup steps are used. Currently available cleanup steps are:

  • mending of single precision coincidence even though double precision vertices differ.
  • union of nearly identical vertices, irrespectively of their origin. Parameters: meshes - [in] A group of meshes that are worked on together. A single mesh is also OK. tolerance - [in] A 3d distance. This is usually a value of about 10e-7 magnitude. Returns: true if the step is required for mesh booleans, intersections, etc, false otherwise.

◆ ReserveVertexCapacity()

bool ON_Mesh::ReserveVertexCapacity ( size_t  new_vertex_capacity)

Description: Increases the capactiy of arrays used to hold vertex information. Parameters: new_vertex_capacity - [in] desired capacity Returns: true if successful. Remarks: 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)

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

◆ SeparateNgons()

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

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

◆ SetCachedTextureCoordinatesEx()

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

◆ SetClosed()

void ON_Mesh::SetClosed ( int  closed)

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

◆ SetCurvatureColorAnalysisColors()

bool ON_Mesh::SetCurvatureColorAnalysisColors ( bool  bLazy,
ON_SurfaceCurvatureColorMapping  kappa_colors 
)

Set the mesh's per vertex colors in m_C[] from the surface principal curvatures in m_K[]

Parameters
bLazyIf bLazy is true, the mesh has curvatures and per vertex colors, and m_Ctag == kappa_colors.ColorMappingTag(), then m_C[] is assumed to be set correctly and no calculations are performed.
kappa_colorsm_C[i] = kappa_colors.Color(m_K[i])
Returns

◆ SetDraftAngleColorAnalysisColors()

bool ON_Mesh::SetDraftAngleColorAnalysisColors ( bool  bLazy,
ON_SurfaceDraftAngleColorMapping  draft_angle_colors 
)

Parameters
bLazy
draft_angle_colors
Returns

◆ SetMappingMeshInfo()

bool ON_Mesh::SetMappingMeshInfo ( const ON_MappingMeshInfo info)

◆ SetMeshParameters()

void ON_Mesh::SetMeshParameters ( const ON_MeshParameters )

◆ SetNgonCount()

void ON_Mesh::SetNgonCount ( unsigned int  ngon_count)

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

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

◆ SetRenderMeshInfo()

bool ON_Mesh::SetRenderMeshInfo ( const ON_RenderMeshInfo info)

◆ SetSolidOrientation()

void ON_Mesh::SetSolidOrientation ( int  solid_orientation)

Description: 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. Parameters: 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 ( )

Description: If the mesh does not have surface evaluation 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 
)

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

◆ SetTextureCoordinatesEx()

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

Description: 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. bSeamCheck - [in] If true then some mesh edges might be unwelded to better represent UV discontinuities in the texture mapping. This only happens for the following mappings: Box, Sphere, Cylinder. 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 
)

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

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

◆ Split()

bool ON_Mesh::Split ( const ON_SimpleArray< const ON_Mesh * > &  meshesThatSplit,
double  tolerance,
bool  splitAtCoplanar,
bool  createNgons,
bool *  somethingHappened,
ON_SimpleArray< ON_Mesh * > &  results,
ON_TextLog log,
ON_Terminator cancel,
ON_ProgressReporter reporter 
) const

Description: Splits the current mesh and returns the split result. If nothing happened, the current mesh is not copied. Instead, somethingHappened is set to false. Parameters: meshesThatSplit - [in] The mesh splitters. nullptr entries are tolerated. tolerance - [in] A 3d-distance tolerance value. If tolerance is:

  • negative: the positive value will be used.
  • 0.0: no tolerance will be used. This is rarely useful, and only in cases where perforations intersections happen inside faces, and/or there is coplanarity parallel to one of the three fundamental axes.
  • ON_DBL_QNAN, ON_UNSET_VALUE and ON_UNSET_POSITIVE_VALUE: the function picks a suitable, or default, tolerance value. WARNING! Generally, good tolerance values for objects drawn near the origin are in the magnitude of 10^-7, or ON_SQRT_EPSILON * 10. Often, the document absolute tolerance is not a good tolerance value. You might use a fractional coefficient to scale the document tolerance to a suitable value, while accepting a user-provided value. This function expects that each mesh conforms to the tolerance that is provided, and that means that features in the mesh are always larger than the mentioned tolerance. Coplanar gaps between meshes that are smaller than tolerance are overlaps. somethingHappened - [out] If not nullptr, informs the caller if the mesh was actually hit by anything. results - [out] This array will be filled with the split result. If nothing happened, the current mesh is not copied. log - [out] If not nullptr, intersection warnings and errors are printed here. If the intersection runs smoothly, nothing will be printed. cancel - [out] If not nullptr, a trigger to request termination. When cancellation is requested, the return value will often be false. You are responsible to delete new objects that were returned, even if you requested cancellation. reporter - [out] If not nullptr, an indicative progress is reported. Returns: true if the computation finished successfully, false otherwise.

◆ SplitArray()

static bool ON_Mesh::SplitArray ( const ON_SimpleArray< const ON_Mesh * > &  meshesToSplit,
const ON_SimpleArray< const ON_Mesh * > &  meshesThatSplit,
double  tolerance,
bool  splitAtCoplanar,
bool  createNgons,
bool *  somethingHappened,
ON_SimpleArray< ON_Mesh * > &  results,
ON_TextLog log,
ON_Terminator cancel,
ON_ProgressReporter reporter 
)
static

Splits a list of meshes. See the parameter description two methods above. Additional parameter: createNgons - If true, ngons are created along the splitting ridge to preserve the boundary look.

◆ SwapCoordinates()

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

Description: Swaps object coordinate values with indices i and j.

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

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

Example:

     ON_Point point(7,8,9);
     point.SwapCoordinates(0,2);
     ///< point = (9,8,7) 

Reimplemented from ON_Geometry.

◆ SwapEdge()

bool ON_Mesh::SwapEdge ( int  topei)

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

mesh topology

In order to keep the mesh facet definition simple and make the mesh definition easily used in common rendering application, if two facets share a vertex location but have different normals, curvatures, textures, etc., at that common vertex location, then the vertex is duplicated. When the topology of the mesh needs to be known, use Topology() to get a class that provides complete topological information about the mesh.

◆ 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. obsolete - used HasMeshTopology()

◆ Transform()

bool ON_Mesh::Transform ( const ON_Xform xform)
overridevirtual

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

Remarks: When overriding this function, be sure to include a call to ON_Object::TransformUserData() which takes care of transforming any ON_UserData that may be attached to the object.

See Also: ON_Geometry::IsDeformable();

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

Reimplemented from ON_Geometry.

◆ TransformMappingMeshInfo()

void ON_Mesh::TransformMappingMeshInfo ( const ON_Xform xform)

◆ TransposeSurfaceParameters()

bool ON_Mesh::TransposeSurfaceParameters ( )

◆ TransposeTextureCoordinates()

bool ON_Mesh::TransposeTextureCoordinates ( )

Description: Transposes the texture coordinates Returns true - success

◆ TriangleCount()

int ON_Mesh::TriangleCount ( ) const

number of faces that are triangles

◆ UnitizeFaceNormals()

bool ON_Mesh::UnitizeFaceNormals ( )

◆ UnitizeVertexNormals()

bool ON_Mesh::UnitizeVertexNormals ( )

◆ UpdateDoublePrecisionVertices()

void ON_Mesh::UpdateDoublePrecisionVertices ( )

Description: If you modify the values of the single precision vertices in m_V[], then you must call UpdateDoublePrecisionVertices(). Remarks: If double precision vertices are not present, this function creates them.

◆ UpdateSinglePrecisionVertices()

void ON_Mesh::UpdateSinglePrecisionVertices ( )

Description: If you modify the values of double precision vertices, then you must call UpdateSinglePrecisonVertices(). Remarks: If double precision vertices are not present, this function does nothing.

◆ V4V5_DestroyNgonList()

void ON_Mesh::V4V5_DestroyNgonList ( )

Description: Destroy any existing N-gon list.

◆ V4V5_ModifyNgonList()

class ON_V4V5_MeshNgonList* ON_Mesh::V4V5_ModifyNgonList ( )

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

mesh N-gon lists.
ON_Mesh objects support faces that are triangle or quads. When a mesh is created from a format that supports N-gons for N larger than 4, an optional N-gon list can be added that specifies the vertices and faces that make up the N-gon. Description: 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

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

◆ Volume()

double ON_Mesh::Volume ( ON_3dPoint  base_point = ON_3dPoint::Origin,
double *  error_estimate = nullptr 
) const

Description: Compute volume of the mesh. Parameters: base_point - [in] optional base point When computing the volume of solid defined by several meshes, pass the same base_point to each call to volume. When computing the volume of a solid defined by a single mesh, the center of the bounding box is a good choice for base_point. error_estimate - [out] if not nullptr, an upper bound on the error in the volume calculation is returned. Returns: volume of the mesh. Example:

/ Assume a solid is enclosed by 3 meshes, mesh1, mesh2, and mesh3. / The volume of the solid can be computed as follows. ON_Mesh mesh1=..., mesh2=..., mesh3=...; / use the center of the solid's bounding box as a common base point. ON_BoundingBox bbox = mesh1.BoundingBox(); mesh2.GetBoundingBox(bbox,true); mesh3.GetBoundingBox(bbox,true); ON_3dPoint base_point = bbox.Center() double vol1_err, vol2_err, vol3_err; double vol1 = mesh1.Volume(base_point,&vol1_err); double vol2 = mesh2.Volume(base_point,&vol2_err); double vol3 = mesh3.Volume(base_point,&vol3_err); double volume = vol1 + vol2 + vol3; double error_estimate = vol1_err + vol2_err + vol3_err; printf("mesh volumd = %g (+/- %g)\n",volume,error_estimate);

◆ VolumeCentroid()

ON_3dPoint ON_Mesh::VolumeCentroid ( ON_3dPoint  base_point = ON_3dPoint::Origin,
double *  volume = nullptr 
) const

Description: Compute volume centroid of the mesh. Parameters: base_point - [in] When computing the centroid of a solid volume defined by several meshes, pass the same base_point to each call to GetVolumeCentroid() and add the answers. When computing the centroid of a solid defined by a single mesh, the center of the bounding box is a good choice for base_point. volume - [out] it not nullptr, Volume of the mesh Returns: Location of the volume centroid.

◆ VolumeMassProperties()

bool ON_Mesh::VolumeMassProperties ( class ON_MassProperties mp,
bool  bVolume = true,
bool  bFirstMoments = true,
bool  bSecondMoments = true,
bool  bProductMoments = true,
ON_3dPoint  base_point = ON_3dPoint::UnsetPoint 
) const

Description: Calculate volume mass properties of the mesh. Parameters: base_point - [in] When computing the volume mass properties of a solid volume defined by several meshes, pass the same base_point to each call to VolumeMassProperties() and add the answers. When computing the volume mass properties of a solid defined by a single mesh, the center of the bounding box is a good choice for base_point. If the mesh is closed, you can pass ON_3dPoint::UnsetPoint and the center of the bounding box will be used. mp - [out] bVolume - [in] true to calculate volume bFirstMoments - [in] true to calculate volume first moments, volume, and volume centroid. bSecondMoments - [in] true to calculate volume second moments. bProductMoments - [in] true to calculate volume product moments. base_point - [in] If the surface is closed, then pass ON_UNSET_VALUE.

This parameter is for expert users who are computing a volume whose boundary is defined by several non-closed breps, surfaces, and meshes.

When computing the volume, volume centroid, or volume first moments of a volume whose boundary is defined by several breps, surfaces, and meshes, pass the same base_point to each call to VolumeMassProperties.

When computing the volume second moments or volume product moments of a volume whose boundary is defined by several breps, surfaces, and meshes, you MUST pass the entire volume's centroid as the base_point and the input mp parameter must contain the results of a previous call to VolumeMassProperties(mp,true,true,false,false,base_point). In particular, in this case, you need to make two sets of calls; use first set to calculate the volume centroid and the second set calculate the second moments and product moments. Returns: True if successful.

◆ Write()

bool ON_Mesh::Write ( ON_BinaryArchive binary_archive) const
overridevirtual

Description: Low level archive writing tool used by ON_BinaryArchive::WriteObject(). Parameters: binary_archive - archive to write to Returns: Returns true if the write is successful. Remarks: 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

◆ Empty

const ON_Mesh ON_Mesh::Empty
static

◆ m_C

ON_SimpleArray<ON_Color> ON_Mesh::m_C

OPTIONAL vertex color Either m_C[] has zero count or it has the same count as m_V[], in which case m_C[j] reports the color assigned to m_V[j].

◆ m_Ctag

ON_MappingTag ON_Mesh::m_Ctag

Implementation - false color.

OPTIONAL tag for values in m_C[]

◆ m_dV

ON_3dPointArray ON_Mesh::m_dV

Description: 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_FN[] OPTIONAL face unit normals If m_FN[] is empty or m_FN.Count() != m_F.Count(), then m_FN is ignored. Otherwise m_FN[j] is the unit normal for the facet m_F[j].

◆ m_H

ON_SimpleArray<bool> ON_Mesh::m_H

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

OPTIONAL vertex visibility. If m_H.Count() = m_V.Count(), then m_H[vi] is true if the vertex m_V[vi] is hidden. Otherwise, all vertices are visible.

◆ m_hidden_count

int ON_Mesh::m_hidden_count

number of vertices that are hidden = number of true values in m_H[] array.

◆ m_invalid_count

int ON_Mesh::m_invalid_count
protected

◆ m_K

Implementation - curvature.

OPTIONAL surface curvatures Either m_K[] has zero count or it has the same count as m_V[], in which case m_K[j] reports the surface curvatures at m_V[j].

◆ m_kstat

ON_MeshCurvatureStats* ON_Mesh::m_kstat[4]
protected

gaussian,mean,min,max,sectionx,sectiony,sectionz

◆ m_mesh_parameters

ON_MeshParameters* ON_Mesh::m_mesh_parameters
protected

If mesh was created from a parametric surface, these parameters were used to create the mesh.

◆ m_N

ON_3fVectorArray ON_Mesh::m_N

Vertex and Face normal implementation m_N[] OPTIONAL vertex unit normals If m_N[] is empty or m_N.Count() != m_V.Count(), Either m_N[] has zero count or it m_N[j] is the the unit vertex normal at m_V[j].

◆ m_nbox

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

3d bounding box of all referenced unit normals (for estimation of Gauss map bounds)

◆ m_Ngon

ON_SimpleArray<ON_MeshNgon*> ON_Mesh::m_Ngon

◆ m_NgonAllocator

ON_MeshNgonAllocator ON_Mesh::m_NgonAllocator

use this to allocate elements added to m_Ngon;

◆ m_NgonMap

ON_SimpleArray<unsigned int> ON_Mesh::m_NgonMap

invalid if m_NgonMap.Count() != m_F.Count()

N-gon implementation If ON_Mesh::HasNgons() is true, then the mesh has n-gons. When a mesh has ngons, m_NgonMap[] is used to determine when a face belongs to an n-gon. If m_NgonMap[fi] < m_Ngon.UnsignedCount(), then it is the index of the N-gon in m_Ngon[] that m_F[] belongs to. Otherwise, m_NgonMap[fi] is ON_UNSET_UINT_INDEX.

◆ m_packed_tex_domain

ON_Interval ON_Mesh::m_packed_tex_domain[2]

Packed texture information.

If either of the m_packed_tex_domain[] intervals is a proper subinterval of (0,1), then a texture packing calculation assigned this subrectangle to this mesh.

◆ m_packed_tex_rotate

bool ON_Mesh::m_packed_tex_rotate

The m_packed_tex_rotate setting is valid only when m_S, m_srf_domain, m_packed_scale[] and m_packed_tex_domain[] are all valid and the texture coordinates are based on surface evaluation parameters. In this special situation, this boolean records the correspondence between the the surface parameters, (u,v), and the packed texture coordinates, (s,t),

m_packed_tex_rotate = false: a = m_srf_domain[0].NormalizedParameterAt(u); b = m_srf_domain[1].NormalizedParameterAt(v); /// s = m_packed_tex_domain[0].ParameterAt(a); t = m_packed_tex_domain[1].ParameterAt(b);

x = m_packed_tex_domain[0].NormalizedParameterAt(s); y = m_packed_tex_domain[1].NormalizedParameterAt(t); u = m_srf_domain[0].ParameterAt(x); v = m_srf_domain[1].ParameterAt(y);

m_packed_tex_rotate = true: a = m_srf_domain[0].NormalizedParameterAt(u); b = m_srf_domain[1].NormalizedParameterAt(v); s = m_packed_tex_domain[0].ParameterAt(a); t = m_packed_tex_domain[1].ParameterAt(1.0-b);

x = m_packed_tex_domain[0].NormalizedParameterAt(s); y = m_packed_tex_domain[1].NormalizedParameterAt(t); u = m_srf_domain[0].ParameterAt(y); v = m_srf_domain[1].ParameterAt(1.0 - x);

◆ m_parent

const ON_Object* ON_Mesh::m_parent

Implementation - runtime UI information.

runtime parent geometry (use ...::Cast() to get it)

◆ 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

If m_T.Count() == m_V.Count(), then the mesh has texture coordinates and m_T[j] is the texture coordinate for vertex m_V[j].

When opennurbs or Rhino meshes an ON_Surface or ON_Brep, the texture coordinates have a "canonical" linear relationship with the surface parameters that is described in the next section. However, various mappings, spherical, planar, cylindrical, etc., can be applied that change the values of the texture coordinates.

If a texture mapping function was used to set the m_T[] values, then the id and serial number of the mapping function is saved in m_mapping_id and m_mapping_sn. The intended use of these fields is to make it easy to avoid unnecessary recalculation.
If a mesh is modified, then m_mapping_id should be set to nil and m_mapping_crc should be set to 0. Texture coordinates / surface parameters

If m_S.Count() == m_V.Count(), then the mesh has texture coordinates, or it is a tessellation of a parameteric surface and m_S[j] is the texture coordinate / surface parameter at m_V[j]. If the values in m_S are changed, then you need to call InvalidateCachedTextureCoordinates(). Storing values in m_S[] is OPTIONAL.

◆ m_srf_domain

ON_Interval ON_Mesh::m_srf_domain[2]

Packed texture information.

surface evaluation domain.

◆ m_srf_scale

double ON_Mesh::m_srf_scale[2]

If m_srf_scale[] has positive values, then they represent the world coordinate size of a rectangle that would minimize texture distortion if it were mapped to the mesh using normalized surface evaluation parameters. This information is used to calculate high quality packed texture coordinates.

◆ m_T

ON_2fPointArray ON_Mesh::m_T

DEPRECATED.

The m_T array has been DEPRECATED. Please don't use it. Instead, use the m_S array to store per-vertex texture coordinates.

◆ m_tbox

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

2d bounding box of all referenced texture coordinates

◆ m_TC

RUNTIME ONLY This array is used to cache texture coordinates used by rendering applications that require 1d, 2d or 3d texture coordinates, or multiple sets of texture coordinates (e.g. blended textures with different mappings). Users are responsible for verifying m_TC[i].m_T.Count() = m_V.Count()

◆ 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

The m_Ttag member has been DEPRECATED. Please don't use it.

Implementation - texture coordinates

OPTIONAL texture coordinates for each vertex DEPRECATED

◆ m_V

ON_3fPointArray ON_Mesh::m_V