ImFusion C++ SDK 4.5.0
ImFusion::MeshProcessing::Misc Namespace Reference

Miscellaneous mesh processing functions. More...

Detailed Description

Miscellaneous mesh processing functions.

Enumerations

enum class  FillType { None = 0 , Bottom , Top }
 Filling type for the label map computation. More...

Functions

bool invertNormals (Mesh &mesh)
 Invert the vertex normals of the Mesh. Returns false if mesh has no vertex normals.
void burnInTransformation (Mesh &mesh, const mat4 &transformation)
 Applies the transformation to all mesh vertices.
std::unique_ptr< TypedImage< unsigned char > > computeLabelMap (const Mesh &mesh, const vec3 &resolution, unsigned int margin=10, unsigned int dir=2, FillType fill=FillType::None, vec3i *targetDim=nullptr, const std::optional< mat4 > &transformation=std::nullopt)
 Compute label map volume from the mesh, representing the inside of a closed surface.
void erodeBoundary (Mesh &mesh, int layers)
 Removes mesh boundary faces (faces which have at least one boundary edge).
bool transferMeshFaceLabels (const Mesh &meshSrc, Mesh &meshDst)
 Transfer face labels from source mesh to destination mesh by propagating the label of its nearest neighbor.

Enumeration Type Documentation

◆ FillType

Filling type for the label map computation.

Enumerator
None 

no closing

Bottom 

close label map in the bottom of axis

Top 

close label map on the top of axis

Function Documentation

◆ burnInTransformation()

void ImFusion::MeshProcessing::Misc::burnInTransformation ( Mesh & mesh,
const mat4 & transformation )

Applies the transformation to all mesh vertices.

Transformation is also applied to vertex normals, halfedge normals and face normals if present

Parameters
[in,out]meshMesh
[in]transformationThe transformation matrix

◆ computeLabelMap()

std::unique_ptr< TypedImage< unsigned char > > ImFusion::MeshProcessing::Misc::computeLabelMap ( const Mesh & mesh,
const vec3 & resolution,
unsigned int margin = 10,
unsigned int dir = 2,
FillType fill = FillType::None,
vec3i * targetDim = nullptr,
const std::optional< mat4 > & transformation = std::nullopt )

Compute label map volume from the mesh, representing the inside of a closed surface.

Warning
The mesh transformation matrix is ignored here. You can, however, supply any transformation matrix (including the meshes own one) as an optional argument.
Note
It is expected that either the mesh is centered at the origin or transformed accordingly by transformation. If this is not the case it can not be assured that the label map fully covers the mesh.
Parameters
[in,out]meshMesh
[in]resolutionResolution of a single voxel
[in]marginAdditional voxels added at the volume boundaries (will be ignored if targetDim is given)
[in]dirAxis along which ray-mesh intersection should be performed (0 is x-axis, 1 is y-axis, 2 is z-axis)
[in]fillSpecifies whether the label map should be manually closed in case of an open mesh (optional, default is 'None')
[in]targetDimOptional target dimension of the computed volume. If not provided, the dimension will be computed as [mesh extent] * [resolution] + [margin]
[in]transformationAn optional transformation to be applied to the mesh (default none).
Returns
Label map with inside voxels set to 1, outside voxels set to 0

◆ erodeBoundary()

void ImFusion::MeshProcessing::Misc::erodeBoundary ( Mesh & mesh,
int layers )

Removes mesh boundary faces (faces which have at least one boundary edge).

Parameters
[in,out]meshmesh
layersnumber of layers of boundary faces to be removed
Note
Consider removing duplicated vertices by calling Cleaning::mergeCloseVertices before this
Search Tab / S to search, Esc to close