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. | |
const UndirectedEdgeBitSet * | edgesToCollapse = 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 VertBitSet * | bdVerts = 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 |
Parameters structure for MR::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 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
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
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 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.
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::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 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::touchBdVertices = true |
Whether to allow collapsing edges having at least one vertex on (region) boundary.
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.