MeshLib
 
Loading...
Searching...
No Matches
Filling holes

Example of filling holes

#include <MRMesh/MRMesh.h>
int main()
{
// Load mesh
// Find single edge for each hole in mesh
std::vector<MR::EdgeId> holeEdges = mesh.topology.findHoleRepresentiveEdges();
for ( MR::EdgeId e : holeEdges )
{
// Setup filling parameters
params.metric = MR::getUniversalMetric( mesh );
// Fill hole represented by `e`
MR::fillHole( mesh, e, params );
}
// Save result
auto saveRes = MR::MeshSave::toAnySupportedFormat( mesh, "filledMesh.stl" );
}
MRMESH_API std::vector< EdgeId > findHoleRepresentiveEdges() const
returns one edge with no valid left face for every boundary in the mesh
MRMESH_API FillHoleMetric getUniversalMetric(const Mesh &mesh)
MRMESH_API void fillHole(Mesh &mesh, EdgeId a, const FillHoleParams &params={})
Fills hole in mesh .
MRMESH_API Expected< Mesh > fromAnySupportedFormat(const std::filesystem::path &file, const MeshLoadSettings &settings={})
detects the format from file extension and loads mesh from it
MRMESH_API VoidOrErrStr toAnySupportedFormat(const Mesh &mesh, const std::filesystem::path &file, const SaveSettings &settings={})
detects the format from file extension and save mesh to it
Parameters structure for MR::fillHole Structure has some options to control MR::fillHole.
FillHoleMetric metric
Definition MRMesh/MRMeshFillHole.h:30
Definition MRMesh/MRMesh.h:23
MeshTopology topology
Definition MRMesh/MRMesh.h:24