MeshLib
 
Loading...
Searching...
No Matches
MR::DecimateSettings Struct Reference

Parameters structure for MR::decimateMesh. More...

#include <MRMeshDecimate.h>

Public Attributes

DecimateStrategy strategy = DecimateStrategy::MinimizeError
 
float maxError = 0.001f
 
float maxEdgeLen = FLT_MAX
 Maximal possible edge length created during decimation.
 
float maxBdShift = FLT_MAX
 Maximal shift of a boundary during one edge collapse.
 
float maxTriangleAspectRatio = 20
 Maximal possible aspect ratio of a triangle introduced during decimation.
 
float criticalTriAspectRatio = FLT_MAX
 
float tinyEdgeLength = -1
 edges not longer than this value will be collapsed even if it results in appearance of a triangle with high aspect ratio
 
float stabilizer = 0.001f
 
bool optimizeVertexPos = true
 
int maxDeletedVertices = INT_MAX
 Limit on the number of deleted vertices.
 
int maxDeletedFaces = INT_MAX
 Limit on the number of deleted faces.
 
FaceBitSetregion = nullptr
 Region on mesh to be decimated, it is updated during the operation.
 
UndirectedEdgeBitSetnotFlippable = nullptr
 Edges specified by this bit-set will never be flipped, but they can be collapsed or replaced during collapse of nearby edges so it is updated during the operation.
 
const UndirectedEdgeBitSetedgesToCollapse = nullptr
 If pointer is not null, then only edges from here can be collapsed (and some nearby edges can disappear)
 
bool touchBdVertices = true
 Whether to allow collapsing edges having at least one vertex on (region) boundary.
 
const VertBitSetbdVerts = nullptr
 
float maxAngleChange = -1
 
std::function< bool(EdgeId edgeToCollapse, const Vector3f &newEdgeOrgPos) preCollapse )
 The user can provide this optional callback that is invoked immediately before edge collapse;.
 
std::function< void(UndirectedEdgeId ue, float &collapseErrorSq, Vector3f &collapsePos) adjustCollapse )
 The user can provide this optional callback for adjusting error introduced by this edge collapse and the collapse position.
 
std::function< void(EdgeId e, EdgeId e1)> onEdgeDel
 
Vector< QuadraticForm3f, VertId > * vertForms = nullptr
 If not null, then vertex quadratic forms are stored there; if on input the vector is not empty then initialization is skipped in favor of values from there; on output: quadratic form for each remaining vertex is returned there.
 
bool packMesh = false
 whether to pack mesh at the end
 
ProgressCallback progressCallback = {}
 callback to report algorithm progress and cancel it by user request
 
int subdivideParts = 1
 

Detailed Description

Parameters structure for MR::decimateMesh.

See also
decimateMesh

Member Data Documentation

◆ adjustCollapse

std::function<void( UndirectedEdgeId ue, float & collapseErrorSq, Vector3f & collapsePos ) MR::DecimateSettings::adjustCollapse)

The user can provide this optional callback for adjusting error introduced by this edge collapse and the collapse position.

On input the callback gets the squared error and position computed by standard means, and callback can modify any of them. The larger the error, the later this edge will be collapsed. This callback can be called from many threads in parallel and must be thread-safe. This callback can be called many times for each edge before real collapsing, and it is important to make the same adjustment.

◆ bdVerts

const VertBitSet* MR::DecimateSettings::bdVerts = nullptr

if touchBdVertices=false then the algorithm needs to know about all boundary vertices; if the pointer is not null then boundary vertices detection is skipped in favor of values from there

◆ criticalTriAspectRatio

float MR::DecimateSettings::criticalTriAspectRatio = FLT_MAX

the algorithm will ignore dihedral angle check if one of triangles had aspect ratio equal or more than this value; and the algorithm will permit temporary increase in aspect ratio after collapse, if before collapse one of the triangles had larger aspect ratio

◆ edgesToCollapse

const UndirectedEdgeBitSet* MR::DecimateSettings::edgesToCollapse = nullptr

If pointer is not null, then only edges from here can be collapsed (and some nearby edges can disappear)

◆ maxAngleChange

float MR::DecimateSettings::maxAngleChange = -1

Permit edge flips (in addition to collapsing) to improve Delone quality of the mesh if it does change dihedral angle more than on this value (negative value prohibits any edge flips)

◆ maxBdShift

float MR::DecimateSettings::maxBdShift = FLT_MAX

Maximal shift of a boundary during one edge collapse.

◆ maxDeletedFaces

int MR::DecimateSettings::maxDeletedFaces = INT_MAX

Limit on the number of deleted faces.

◆ maxDeletedVertices

int MR::DecimateSettings::maxDeletedVertices = INT_MAX

Limit on the number of deleted vertices.

◆ maxEdgeLen

float MR::DecimateSettings::maxEdgeLen = FLT_MAX

Maximal possible edge length created during decimation.

◆ maxError

float MR::DecimateSettings::maxError = 0.001f

for DecimateStrategy::MinimizeError: stop the decimation as soon as the estimated distance deviation from the original mesh is more than this value for DecimateStrategy::ShortestEdgeFirst only: stop the decimation as soon as the shortest edge in the mesh is greater than this value

◆ maxTriangleAspectRatio

float MR::DecimateSettings::maxTriangleAspectRatio = 20

Maximal possible aspect ratio of a triangle introduced during decimation.

◆ notFlippable

UndirectedEdgeBitSet* MR::DecimateSettings::notFlippable = nullptr

Edges specified by this bit-set will never be flipped, but they can be collapsed or replaced during collapse of nearby edges so it is updated during the operation.

◆ onEdgeDel

std::function<void(EdgeId e, EdgeId e1)> MR::DecimateSettings::onEdgeDel

this function is called each time edge (e) is deleted; if valid (e1) is given then dest(e) = dest(e1) and their origins are in different ends of collapsing edge, e1 shall take the place of e

◆ optimizeVertexPos

bool MR::DecimateSettings::optimizeVertexPos = true

if true then after each edge collapse the position of remaining vertex is optimized to minimize local shape change, if false then the edge is collapsed in one of its vertices, which keeps its position

◆ packMesh

bool MR::DecimateSettings::packMesh = false

whether to pack mesh at the end

◆ preCollapse

std::function<bool( EdgeId edgeToCollapse, const Vector3f & newEdgeOrgPos) MR::DecimateSettings::preCollapse)

The user can provide this optional callback that is invoked immediately before edge collapse;.

It receives the edge being collapsed: its destination vertex will disappear, and its origin vertex will get new position (provided as the second argument) after collapse; If the callback returns false, then the collapse is prohibited

◆ progressCallback

ProgressCallback MR::DecimateSettings::progressCallback = {}

callback to report algorithm progress and cancel it by user request

◆ region

FaceBitSet* MR::DecimateSettings::region = nullptr

Region on mesh to be decimated, it is updated during the operation.

◆ stabilizer

float MR::DecimateSettings::stabilizer = 0.001f

Small stabilizer is important to achieve good results on completely planar mesh parts, if your mesh is not-planer everywhere, then you can set it to zero

◆ strategy

DecimateStrategy MR::DecimateSettings::strategy = DecimateStrategy::MinimizeError

◆ subdivideParts

int MR::DecimateSettings::subdivideParts = 1

If this value is more than 1, then virtually subdivides the mesh on given number of parts to process them in parallel (using many threads); unlike decimateParallelMesh it does not create copies of mesh regions, so may take less memory to operate; IMPORTANT: please call mesh.packOptimally() before calling decimating with subdivideParts > 1, otherwise performance will be bad

◆ tinyEdgeLength

float MR::DecimateSettings::tinyEdgeLength = -1

edges not longer than this value will be collapsed even if it results in appearance of a triangle with high aspect ratio

◆ touchBdVertices

bool MR::DecimateSettings::touchBdVertices = true

Whether to allow collapsing edges having at least one vertex on (region) boundary.

◆ vertForms

Vector<QuadraticForm3f, VertId>* MR::DecimateSettings::vertForms = nullptr

If not null, then vertex quadratic forms are stored there; if on input the vector is not empty then initialization is skipped in favor of values from there; on output: quadratic form for each remaining vertex is returned there.


The documentation for this struct was generated from the following file: