MeshLib C++ Docs
Loading...
Searching...
No Matches
Decimate overview

This chapter represents documentation about mesh decimation. More...

Classes

struct  MR::DecimateSettings
 Parameters structure for MR::decimateMesh. More...
struct  MR::DecimateResult
 Results of MR::decimateMesh. More...
struct  MR::ResolveMeshDegenSettings
struct  MR::RemeshSettings
struct  MR::DecimatePolylineSettings< V >
 Parameters structure for MR::decimatePolyline. More...

Enumerations

enum  MR::DecimateStrategy { MR::MinimizeError , MR::ShortestEdgeFirst }
 Defines the order of edge collapses inside Decimate algorithm. More...

Functions

DecimateResult MR::decimateMesh (Mesh &mesh, const DecimateSettings &settings={})
 Performs mesh simplification in mesh region according to the settings.
DecimateResult MR::decimateObjectMeshData (ObjectMeshData &data, const DecimateSettings &settings)
std::optional< ObjectMeshDataMR::makeDecimatedObjectMeshData (const ObjectMesh &obj, const DecimateSettings &settings, DecimateResult *outRes=nullptr)
 returns the data of decimated mesh given ObjectMesh (which remains unchanged) and decimation parameters
QuadraticForm3f MR::computeFormAtVertex (const MeshPart &mp, VertId v, float stabilizer, bool angleWeigted, const UndirectedEdgeBitSet *creases=nullptr)
 Computes quadratic form at given vertex of the initial surface before decimation.
Vector< QuadraticForm3f, VertId > MR::computeFormsAtVertices (const MeshPart &mp, float stabilizer, bool angleWeigted, const UndirectedEdgeBitSet *creases=nullptr)
 Computes quadratic forms at every vertex of mesh part before decimation.
FaceBitSet MR::getSubdividePart (const FaceBitSet &valids, size_t subdivideParts, size_t myPart)
 returns given subdivision part of all valid faces; parallel threads shall be able to safely modify these bits because they do not share any block with other parts
bool MR::resolveMeshDegenerations (Mesh &mesh, const ResolveMeshDegenSettings &settings={})
 Removes degenerate triangles in a mesh by calling decimateMesh function with appropriate settings.
bool MR::remesh (Mesh &mesh, const RemeshSettings &settings)
 Splits too long and eliminates too short edges from the mesh.
DecimatePolylineResult MR::decimatePolyline (Polyline2 &polyline, const DecimatePolylineSettings2 &settings={})
 Collapse edges in the polyline according to the settings.
DecimatePolylineResult MR::decimateContour (Contour2f &contour, const DecimatePolylineSettings2 &settings={})
 Collapse edges in the contour according to the settings.

Detailed Description

This chapter represents documentation about mesh decimation.

Enumeration Type Documentation

◆ DecimateStrategy

#include <MRMesh/MRMeshDecimate.h>

Defines the order of edge collapses inside Decimate algorithm.

Enumerator
MinimizeError 

the next edge to collapse will be the one that introduced minimal error to the surface

ShortestEdgeFirst 

the next edge to collapse will be the shortest one

Function Documentation

◆ computeFormAtVertex()

QuadraticForm3f MR::computeFormAtVertex ( const MeshPart & mp,
VertId v,
float stabilizer,
bool angleWeigted,
const UndirectedEdgeBitSet * creases = nullptr )
nodiscard

#include <MRMesh/MRMeshDecimate.h>

Computes quadratic form at given vertex of the initial surface before decimation.

◆ computeFormsAtVertices()

Vector< QuadraticForm3f, VertId > MR::computeFormsAtVertices ( const MeshPart & mp,
float stabilizer,
bool angleWeigted,
const UndirectedEdgeBitSet * creases = nullptr )
nodiscard

#include <MRMesh/MRMeshDecimate.h>

Computes quadratic forms at every vertex of mesh part before decimation.

◆ decimateContour()

DecimatePolylineResult MR::decimateContour ( Contour2f & contour,
const DecimatePolylineSettings2 & settings = {} )

#include <MRMesh/MRPolylineDecimate.h>

Collapse edges in the contour according to the settings.

◆ decimateMesh()

DecimateResult MR::decimateMesh ( Mesh & mesh,
const DecimateSettings & settings = {} )

#include <MRMesh/MRMeshDecimate.h>

Performs mesh simplification in mesh region according to the settings.

Before
After

◆ decimateObjectMeshData()

DecimateResult MR::decimateObjectMeshData ( ObjectMeshData & data,
const DecimateSettings & settings )

#include <MRMesh/MRMeshDecimate.h>

Performs mesh simplification with per-element attributes according to given settings; \detail settings.region must be null, and real simplification region will be data face selection (or whole mesh if no face selection)

◆ decimatePolyline()

DecimatePolylineResult MR::decimatePolyline ( Polyline2 & polyline,
const DecimatePolylineSettings2 & settings = {} )

#include <MRMesh/MRPolylineDecimate.h>

Collapse edges in the polyline according to the settings.

◆ getSubdividePart()

FaceBitSet MR::getSubdividePart ( const FaceBitSet & valids,
size_t subdivideParts,
size_t myPart )
nodiscard

#include <MRMesh/MRMeshDecimate.h>

returns given subdivision part of all valid faces; parallel threads shall be able to safely modify these bits because they do not share any block with other parts

◆ makeDecimatedObjectMeshData()

std::optional< ObjectMeshData > MR::makeDecimatedObjectMeshData ( const ObjectMesh & obj,
const DecimateSettings & settings,
DecimateResult * outRes = nullptr )
nodiscard

#include <MRMesh/MRMeshDecimate.h>

returns the data of decimated mesh given ObjectMesh (which remains unchanged) and decimation parameters

◆ remesh()

bool MR::remesh ( Mesh & mesh,
const RemeshSettings & settings )

#include <MRMesh/MRMeshDecimate.h>

Splits too long and eliminates too short edges from the mesh.

◆ resolveMeshDegenerations()

bool MR::resolveMeshDegenerations ( Mesh & mesh,
const ResolveMeshDegenSettings & settings = {} )

#include <MRMesh/MRMeshDecimate.h>

Removes degenerate triangles in a mesh by calling decimateMesh function with appropriate settings.

consider using fixMeshDegeneracies for more complex cases

Returns
true if the mesh has been changed
See also
decimateMesh