31struct DecimateSettings
121 std::function<void( UndirectedEdgeId ue,
float & collapseErrorSq, Vector3f & collapsePos )>
adjustCollapse;
125 std::function<void( EdgeId del, EdgeId rem )>
onEdgeDel;
196[[nodiscard]]
MRMESH_API QuadraticForm3f
computeFormAtVertex(
const MeshPart & mp, VertId v,
float stabilizer,
const UndirectedEdgeBitSet * creases =
nullptr );
240[[deprecated(
" use the version with parameter struct instead" )]]
283 std::function<bool( EdgeId edgeToCollapse,
const Vector3f& newEdgeOrgPos )>
preCollapse;
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:46
std::vector<T>-like container that requires specific indexing type,
Definition MRMesh/MRVector.h:20
std::function< bool(float)> ProgressCallback
Definition MRMesh/MRMeshFwd.h:576
MRMESH_API DecimateResult decimateMesh(Mesh &mesh, const DecimateSettings &settings={})
Collapse edges in mesh region according to the settings.
MRMESH_API QuadraticForm3f computeFormAtVertex(const MeshPart &mp, VertId v, float stabilizer, const UndirectedEdgeBitSet *creases=nullptr)
Computes quadratic form at given vertex of the initial surface before decimation.
MRMESH_API FaceBitSet 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 th...
MRMESH_API Vector< QuadraticForm3f, VertId > computeFormsAtVertices(const MeshPart &mp, float stabilizer, const UndirectedEdgeBitSet *creases=nullptr)
Computes quadratic forms at every vertex of mesh part before decimation.
MRMESH_API bool resolveMeshDegenerations(Mesh &mesh, const ResolveMeshDegenSettings &settings={})
Resolves degenerate triangles in given mesh.
Definition MRCameraOrientationPlugin.h:8
MRMESH_API bool remesh(Mesh &mesh, const RemeshSettings &settings)
DecimateStrategy
Defines the order of edge collapses inside Decimate algorithm.
Definition MRMesh/MRMeshDecimate.h:19
@ MinimizeError
Definition MRMesh/MRMeshDecimate.h:20
@ ShortestEdgeFirst
Definition MRMesh/MRMeshDecimate.h:21
std::function< bool(EdgeId edgeToCollapse, const Vector3f &newEdgeOrgPos)> PreCollapseCallback
Definition MRMesh/MRMeshFwd.h:427
HashMap< UndirectedEdgeId, UndirectedEdgeId > UndirectedEdgeHashMap
Definition MRMesh/MRMeshFwd.h:467
Results of MR::decimateMesh.
int vertsDeleted
Number deleted verts. Same as the number of performed collapses.
Definition MRMesh/MRMeshDecimate.h:168
int facesDeleted
Definition MRMesh/MRMeshDecimate.h:169
float errorIntroduced
Definition MRMesh/MRMeshDecimate.h:174
bool cancelled
whether the algorithm was cancelled by the callback
Definition MRMesh/MRMeshDecimate.h:176
Parameters structure for MR::decimateMesh.
UndirectedEdgeBitSet * notFlippable
Edges specified by this bit-set will never be flipped, but they can be collapsed or replaced during c...
Definition MRMesh/MRMeshDecimate.h:75
bool collapseNearNotFlippable
Definition MRMesh/MRMeshDecimate.h:79
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 ...
Definition MRMesh/MRMeshDecimate.h:121
bool packMesh
whether to pack mesh at the end
Definition MRMesh/MRMeshDecimate.h:135
int maxDeletedFaces
Limit on the number of deleted faces.
Definition MRMesh/MRMeshDecimate.h:69
PreCollapseCallback preCollapse
The user can provide this optional callback that is invoked immediately before edge collapse;.
Definition MRMesh/MRMeshDecimate.h:111
UndirectedEdgeHashMap * twinMap
Definition MRMesh/MRMeshDecimate.h:87
float maxBdShift
Maximal shift of a boundary during one edge collapse.
Definition MRMesh/MRMeshDecimate.h:45
float criticalTriAspectRatio
Definition MRMesh/MRMeshDecimate.h:52
bool decimateBetweenParts
Definition MRMesh/MRMeshDecimate.h:146
DecimateStrategy strategy
Definition MRMesh/MRMeshDecimate.h:33
int minFacesInPart
minimum number of faces in one subdivision part for ( subdivideParts > 1 ) mode
Definition MRMesh/MRMeshDecimate.h:154
std::vector< FaceBitSet > * partFaces
Definition MRMesh/MRMeshDecimate.h:151
Vector< QuadraticForm3f, VertId > * vertForms
If not null, then vertex quadratic forms are stored there; if on input the vector is not empty then i...
Definition MRMesh/MRMeshDecimate.h:132
int subdivideParts
Definition MRMesh/MRMeshDecimate.h:142
FaceBitSet * region
Region on mesh to be decimated, it is updated during the operation.
Definition MRMesh/MRMeshDecimate.h:72
const VertBitSet * bdVerts
Definition MRMesh/MRMeshDecimate.h:99
ProgressCallback progressCallback
callback to report algorithm progress and cancel it by user request
Definition MRMesh/MRMeshDecimate.h:138
float stabilizer
Definition MRMesh/MRMeshDecimate.h:59
float maxError
Definition MRMesh/MRMeshDecimate.h:39
int maxDeletedVertices
Limit on the number of deleted vertices.
Definition MRMesh/MRMeshDecimate.h:66
float tinyEdgeLength
edges not longer than this value will be collapsed even if it results in appearance of a triangle wit...
Definition MRMesh/MRMeshDecimate.h:55
bool optimizeVertexPos
Definition MRMesh/MRMeshDecimate.h:63
float maxEdgeLen
Maximal possible edge length created during decimation.
Definition MRMesh/MRMeshDecimate.h:42
UndirectedEdgeBitSet * edgesToCollapse
Definition MRMesh/MRMeshDecimate.h:83
bool touchNearBdEdges
Whether to allow collapsing or flipping edges having at least one vertex on (region) boundary.
Definition MRMesh/MRMeshDecimate.h:90
float maxAngleChange
Definition MRMesh/MRMeshDecimate.h:103
bool touchBdVerts
Definition MRMesh/MRMeshDecimate.h:95
float maxTriangleAspectRatio
Maximal possible aspect ratio of a triangle introduced during decimation.
Definition MRMesh/MRMeshDecimate.h:48
std::function< void(EdgeId del, EdgeId rem)> onEdgeDel
Definition MRMesh/MRMeshDecimate.h:125
Definition MRMesh/MRMesh.h:23
Definition MRMesh/MRMeshDecimate.h:245
bool finalRelaxNoShrinkage
if true prevents the surface from shrinkage after many iterations
Definition MRMesh/MRMeshDecimate.h:262
std::function< void(EdgeId e, EdgeId e1)> onEdgeDel
if valid (e1) is given then dest(e) = dest(e1) and their origins are in different ends of collapsing ...
Definition MRMesh/MRMeshDecimate.h:276
std::function< void(EdgeId e1, EdgeId e)> onEdgeSplit
this function is called each time edge (e) is split into (e1->e), but before the ring is made Delone
Definition MRMesh/MRMeshDecimate.h:274
float targetEdgeLen
Definition MRMesh/MRMeshDecimate.h:248
int maxEdgeSplits
Maximum number of edge splits allowed during subdivision.
Definition MRMesh/MRMeshDecimate.h:250
bool useCurvature
Definition MRMesh/MRMeshDecimate.h:257
bool projectOnOriginalMesh
Definition MRMesh/MRMeshDecimate.h:272
float maxAngleChangeAfterFlip
Improves local mesh triangulation by doing edge flips if it does not change dihedral angle more than ...
Definition MRMesh/MRMeshDecimate.h:252
FaceBitSet * region
Region on mesh to be changed, it is updated during the operation.
Definition MRMesh/MRMeshDecimate.h:264
float maxBdShift
Maximal shift of a boundary during one edge collapse.
Definition MRMesh/MRMeshDecimate.h:254
ProgressCallback progressCallback
callback to report algorithm progress and cancel it by user request
Definition MRMesh/MRMeshDecimate.h:285
int finalRelaxIters
Definition MRMesh/MRMeshDecimate.h:260
std::function< bool(EdgeId edgeToCollapse, const Vector3f &newEdgeOrgPos)> preCollapse
The user can provide this optional callback that is invoked immediately before edge collapse;.
Definition MRMesh/MRMeshDecimate.h:283
bool packMesh
whether to pack mesh at the end
Definition MRMesh/MRMeshDecimate.h:269
UndirectedEdgeBitSet * notFlippable
Definition MRMesh/MRMeshDecimate.h:267
Definition MRMesh/MRMeshDecimate.h:212
float maxAngleChange
Permit edge flips if it does not change dihedral angle more than on this value.
Definition MRMesh/MRMeshDecimate.h:220
float maxDeviation
maximum permitted deviation from the original surface
Definition MRMesh/MRMeshDecimate.h:216
FaceBitSet * region
degenerations will be fixed only in given region, which is updated during the processing
Definition MRMesh/MRMeshDecimate.h:228
float criticalAspectRatio
Definition MRMesh/MRMeshDecimate.h:223
float tinyEdgeLength
edges not longer than this value will be collapsed ignoring normals and aspect ratio checks
Definition MRMesh/MRMeshDecimate.h:218
int maxIters
Definition MRMesh/MRMeshDecimate.h:214
float stabilizer
Definition MRMesh/MRMeshDecimate.h:226