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. | |

FaceBitSet * | region = nullptr |

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

UndirectedEdgeBitSet * | 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. | |

bool | collapseNearNotFlippable = false |

const UndirectedEdgeBitSet * | edgesToCollapse = nullptr |

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

UndirectedEdgeHashMap * | twinMap = nullptr |

bool | touchNearBdEdges = true |

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

bool | touchBdVerts = true |

const VertBitSet * | bdVerts = nullptr |

float | maxAngleChange = -1 |

PreCollapseCallback | 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 |

bool | decimateBetweenParts = true |

std::vector< FaceBitSet > * | partFaces = nullptr |

int | minFacesInPart = 0 |

minimum number of faces in one subdivision part for ( subdivideParts > 1 ) mode | |

Parameters structure for MR::decimateMesh.

- See also
- decimateMesh

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.

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

if touchNearBdEdges=false or touchBdVerts=false then the algorithm needs to know about all boundary vertices; if the pointer is not null then boundary vertices detection is replaced with testing values in this bit-set

bool MR::DecimateSettings::collapseNearNotFlippable = false |

Whether to allow collapse of edges incident to notFlippable edges, which can move vertices of notFlippable edges unless they are fixed

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

bool MR::DecimateSettings::decimateBetweenParts = true |

After parallel decimation of all mesh parts is done, whether to perform final decimation of whole mesh region to eliminate small edges near the border of individual parts

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)

float MR::DecimateSettings::maxAngleChange = -1 |

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

float MR::DecimateSettings::maxBdShift = FLT_MAX |

Maximal shift of a boundary during one edge collapse.

int MR::DecimateSettings::maxDeletedFaces = INT_MAX |

Limit on the number of deleted faces.

int MR::DecimateSettings::maxDeletedVertices = INT_MAX |

Limit on the number of deleted vertices.

float MR::DecimateSettings::maxEdgeLen = FLT_MAX |

Maximal possible edge length created during decimation.

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

float MR::DecimateSettings::maxTriangleAspectRatio = 20 |

Maximal possible aspect ratio of a triangle introduced during decimation.

int MR::DecimateSettings::minFacesInPart = 0 |

minimum number of faces in one subdivision part for ( subdivideParts > 1 ) mode

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.

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

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

bool MR::DecimateSettings::packMesh = false |

whether to pack mesh at the end

std::vector<FaceBitSet>* MR::DecimateSettings::partFaces = nullptr |

if not null, then it contains the faces of each subdivision part on input, which must not overlap, and after decimation of all parts, the region inside each part is put here; decimateBetweenParts=true or packMesh=true are not compatible with this option

PreCollapseCallback 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 MR::DecimateSettings::progressCallback |

callback to report algorithm progress and cancel it by user request

FaceBitSet* MR::DecimateSettings::region = nullptr |

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

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

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

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

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

bool MR::DecimateSettings::touchBdVerts = true |

touchBdVerts=true: allow moving and eliminating boundary vertices during edge collapses; touchBdVerts=false: allow only collapsing an edge having only one boundary vertex in that vertex, so position and count of boundary vertices do not change; this setting is ignored if touchNearBdEdges=false

bool MR::DecimateSettings::touchNearBdEdges = true |

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

UndirectedEdgeHashMap* MR::DecimateSettings::twinMap = nullptr |

if an edge present as a key in this map is flipped or collapsed, then same happens to the value-edge (with same collapse position); the algorithm updates this map during collapses, removing or replacing elements

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: