Skip to content

shapeworks::MeshUtils

Module: Mesh Classes

More...

#include <MeshUtils.h>

Public Functions

Name
const vtkSmartPointer< vtkMatrix4x4 > createICPTransform(const Mesh source, const Mesh target, Mesh::AlignmentType align, const unsigned iterations =20, bool meshTransform =false)
computes a rigid transformation from source to target using vtkIterativeClosestPointTransform
Mesh create_mesh_from_file(std::string filename, double iso_value =0.5)
Mesh from mesh or image file.
Mesh threadSafeReadMesh(std::string filename)
Thread safe reading of a mesh, uses a lock.
void threadSafeWriteMesh(std::string filename, Mesh mesh)
Thread safe writing of a mesh, uses a lock.
PhysicalRegion boundingBox(const std::vector< std::string > & filenames, bool center =false)
calculate bounding box incrementally for meshes
PhysicalRegion boundingBox(const std::vector< std::reference_wrapper< const Mesh > > & meshes, bool center =false)
calculate bounding box incrementally for meshes
PhysicalRegion boundingBox(const std::vector< Mesh > & meshes, bool center =false)
calculate bounding box incrementally for meshes
int findReferenceMesh(std::vector< Mesh > & meshes, int random_subset_size =-1)
determine the reference mesh
Mesh extract_boundary_loop(Mesh mesh)
boundary loop extractor for a given mesh
std::array< Mesh, 3 > shared_boundary_extractor(const Mesh & mesh_l, const Mesh & mesh_r, double tol)
shared boundary extractor for the left and right mesh
void generateNormals(const std::vector< std::reference_wrapper< Mesh > > & meshes, bool forceRegen =false)
generates and adds normals for points and faces for each mesh in given set of meshes
Field computeMeanNormals(const std::vector< std::string > & filenames, bool autoGenerateNormals =true)
computes average normals for each point in given set of meshes
Field computeMeanNormals(const std::vector< std::reference_wrapper< const Mesh > > & meshes)
computes average normals for each point in given set of meshes
int evaluate_triangle_position(const double x[3], double closestPoint[3], int & subId, double pcoords[3], double & dist2, double weights[], double pt3[3], double pt1[3], double pt2[3])
vtkSmartPointer< vtkPolyData > clean_mesh(vtkSmartPointer< vtkPolyData > mesh)
Clean mesh (merge points and remove degenerate cells)
vtkSmartPointer< vtkPolyData > remove_zero_area_triangles(vtkSmartPointer< vtkPolyData > mesh)
Remove zero area triangles from a mesh.
vtkSmartPointer< vtkPolyData > recreate_mesh(vtkSmartPointer< vtkPolyData > mesh)
Recreate mesh, dropping deleted cells.
vtkSmartPointer< vtkPolyData > repair_mesh(vtkSmartPointer< vtkPolyData > mesh)
Repair mesh: triangulate, extract largest component, clean, fix non-manifold, remove zero-area triangles.
void visualizeVectorFieldForFFCs(std::shared_ptr< Mesh > mesh)
This function visualizes vector and scalar fields for FFCs.
vtkSmartPointer< vtkActor > getArrow(Eigen::Vector3d start, Eigen::Vector3d end)
Used as an auxiliary function for vector field visualizations.

Detailed Description

cpp class shapeworks::MeshUtils;

This class provides helper functions for meshes

Public Functions Documentation

function createICPTransform

cpp static const vtkSmartPointer< vtkMatrix4x4 > createICPTransform( const Mesh source, const Mesh target, Mesh::AlignmentType align, const unsigned iterations =20, bool meshTransform =false )

computes a rigid transformation from source to target using vtkIterativeClosestPointTransform

function create_mesh_from_file

cpp static Mesh create_mesh_from_file( std::string filename, double iso_value =0.5 )

Mesh from mesh or image file.

function threadSafeReadMesh

cpp static Mesh threadSafeReadMesh( std::string filename )

Thread safe reading of a mesh, uses a lock.

function threadSafeWriteMesh

cpp static void threadSafeWriteMesh( std::string filename, Mesh mesh )

Thread safe writing of a mesh, uses a lock.

function boundingBox

cpp static PhysicalRegion boundingBox( const std::vector< std::string > & filenames, bool center =false )

calculate bounding box incrementally for meshes

function boundingBox

cpp static PhysicalRegion boundingBox( const std::vector< std::reference_wrapper< const Mesh > > & meshes, bool center =false )

calculate bounding box incrementally for meshes

function boundingBox

cpp static PhysicalRegion boundingBox( const std::vector< Mesh > & meshes, bool center =false )

calculate bounding box incrementally for meshes

function findReferenceMesh

cpp static int findReferenceMesh( std::vector< Mesh > & meshes, int random_subset_size =-1 )

determine the reference mesh

function extract_boundary_loop

cpp static Mesh extract_boundary_loop( Mesh mesh )

boundary loop extractor for a given mesh

function shared_boundary_extractor

cpp static std::array< Mesh, 3 > shared_boundary_extractor( const Mesh & mesh_l, const Mesh & mesh_r, double tol )

shared boundary extractor for the left and right mesh

function generateNormals

cpp static void generateNormals( const std::vector< std::reference_wrapper< Mesh > > & meshes, bool forceRegen =false )

generates and adds normals for points and faces for each mesh in given set of meshes

function computeMeanNormals

cpp static Field computeMeanNormals( const std::vector< std::string > & filenames, bool autoGenerateNormals =true )

computes average normals for each point in given set of meshes

function computeMeanNormals

cpp static Field computeMeanNormals( const std::vector< std::reference_wrapper< const Mesh > > & meshes )

computes average normals for each point in given set of meshes

function evaluate_triangle_position

cpp static int evaluate_triangle_position( const double x[3], double closestPoint[3], int & subId, double pcoords[3], double & dist2, double weights[], double pt3[3], double pt1[3], double pt2[3] )

function clean_mesh

cpp static vtkSmartPointer< vtkPolyData > clean_mesh( vtkSmartPointer< vtkPolyData > mesh )

Clean mesh (merge points and remove degenerate cells)

function remove_zero_area_triangles

cpp static vtkSmartPointer< vtkPolyData > remove_zero_area_triangles( vtkSmartPointer< vtkPolyData > mesh )

Remove zero area triangles from a mesh.

function recreate_mesh

cpp static vtkSmartPointer< vtkPolyData > recreate_mesh( vtkSmartPointer< vtkPolyData > mesh )

Recreate mesh, dropping deleted cells.

function repair_mesh

cpp static vtkSmartPointer< vtkPolyData > repair_mesh( vtkSmartPointer< vtkPolyData > mesh )

Repair mesh: triangulate, extract largest component, clean, fix non-manifold, remove zero-area triangles.

function visualizeVectorFieldForFFCs

cpp void visualizeVectorFieldForFFCs( std::shared_ptr< Mesh > mesh )

This function visualizes vector and scalar fields for FFCs.

function getArrow

cpp vtkSmartPointer< vtkActor > getArrow( Eigen::Vector3d start, Eigen::Vector3d end )

Used as an auxiliary function for vector field visualizations.


Updated on 2026-03-31 at 16:02:10 +0000