ImFusion SDK 4.3
ImFusion::MeshProcessing::Cleaning Namespace Reference

Mesh processing algorithms related to cleaning of the mesh. More...

Detailed Description

Mesh processing algorithms related to cleaning of the mesh.

Classes

struct  ImFusionOriginProperty
 Vertex and / or face property indicating the origin of a vertex or face in the mesh, added to the mesh by cropMesh. More...
 

Enumerations

enum class  CropType { InfrontUnion , InfrontIntersection , BehindUnion , BehindIntersection }
 CropType for cropMesh method. More...
 

Functions

void mergeCloseVertices (Mesh &mesh, double delta=0.0, bool allowFaceReordering=false)
 Remove close mesh vertices.
 
void removeIsolatedVertices (Mesh &mesh)
 Remove vertices not belonging to any face.
 
void crop (Mesh &mesh, const vec3 &boxCenter, const vec3 &boxExtent, const bool discardPointsInside, const mat4 &transformation, bool cap=false, Progress *progress=nullptr)
 Deletes all faces that are not inside the given box.
 
void crop (Mesh &mesh, const std::vector< Geometry::Plane > &planes, CropType cropType, bool cap=false, Progress *progress=nullptr)
 Crops a mesh using a set of planes.
 

Enumeration Type Documentation

◆ CropType

enum class CropType
strong

CropType for cropMesh method.

Defines the desired output of the mesh cropping, i.e. which. parts of the mesh are to be kept after cropping.

Enumerator
InfrontUnion 

The union of the regions on the normal side of the planes.

InfrontIntersection 

The intersection of the regions on the normal side of the planes.

BehindUnion 

The union of the regions on the opposite side of the planes normal.

BehindIntersection 

The intersection of the regions on the opposite side of the planes normal.

Function Documentation

◆ mergeCloseVertices()

void mergeCloseVertices ( Mesh & mesh,
double delta = 0.0,
bool allowFaceReordering = false )

Remove close mesh vertices.

This function merges vertices in a mesh that are closer than delta (using the L2 norm). To do so it builds a graph whose nodes $V = {\mathbf{v}_0,...,\mathbf{v}_n}$ represent the vertices of the mesh and whose edges $E$ contain $e_{i,j} \in E \Leftrightarrow ||v_i-v_j|| < \delta$. Connected components in this graph are subsequentially merged into one representative vertex before faces are reassigned to the new vertices. This means that the total circumference of a merged cluster might exceed delta if there is a long "chain" of vertices which are pairwise closer than delta.

Note
This function keeps properties of unique vertices and faces, but the properties of vertices and faces resulting from a merge are copied from the vertex with maximum index in the cluster and from the face with minimum index, respectively.
For vertex colors, normals, and texture coordinates a respective halfedge property will be added if the properties do not match at any vertex. The vertex property will then be removed.
Warning
Merging vertices might change the topology of the mesh, in particular small holes might be closed in the process.
Parameters
[in,out]meshMesh
[in]deltathreshold for the distance between vertices. If distance between vertices is smaller than the threshold, vertices will be merged (optional, default is 0.0)

◆ crop() [1/2]

void crop ( Mesh & mesh,
const vec3 & boxCenter,
const vec3 & boxExtent,
const bool discardPointsInside,
const mat4 & transformation,
bool cap = false,
Progress * progress = nullptr )

Deletes all faces that are not inside the given box.

Operates directly on the input mesh without making a copy

For a detailed explanation and the handling of properties see

See also
cropMesh(Mesh&, const std::vector<Geometry::Plane>&, CropType, bool, Progress*);
Parameters
[in,out]meshMesh
[in]boxCentercenter of the cropping box
[in]boxExtentthe extent in all axes of the cropping box
[in]discardPointsInsideshould the points inside or outside the box be discarded
[in]transformationa transformation that is applied to the cropping box
[in]cap(optional) should cap the cropped mesh, default is false
[in]progress(optional) a pointer to a progress handler, default is nullptr

◆ crop() [2/2]

void crop ( Mesh & mesh,
const std::vector< Geometry::Plane > & planes,
CropType cropType,
bool cap = false,
Progress * progress = nullptr )

Crops a mesh using a set of planes.

The crop parameter defines the desired output of the mesh cropping. Operates directly on the input mesh without making a copy

Mesh attributes will be handled in the following way:

  • A vertex property of type ImFusionOriginProperty::element_type is added to the mesh describing the origin of each mesh vertex in the result, see
    See also
    ImFusionOriginProperty for an explanation
  • Normal, color, and texture coordinate vertex properties are linear interpolated on the intersection curves between planes and mesh
  • Other vertex properties on the intersection curves and vertex properties in the filled regions (if cap` == true) are undefined (except normals, see below).
  • If \a mesh has the vertex normal property the vertex normals in the filled regions are computed. Additionally the halfedge normal property is added and set accordingly to support shading the sharp cropping edges.
  • If \a mesh has vertex color or texture coordinate properties the respective halfedge properties are added and set.
  • If \a mesh has the face normal property all face normals are recomputed.
  • All other existing vertex, face, edge, and halfedge properties are kept at vertices and faces with ImFusionOriginProperty::Original property, at other vertices and faces they are undefined. \note If the mesh is not watertight and the cropping planes cross some boundary, the resulting hole will only be filled between the newly created vertices, i.e. vertices on the planes \param [in,out] mesh Mesh \param [in] planes the cropping planes \param [in] cropType type of cropping \param [in] cap (optional) should the cropped mesh be capped. Default isfalse. \param [in] progress (optional) a pointer to a progress handler. Default isnullptr`.
Search Tab / S to search, Esc to close