3#include "MRPch/MRBindingMacros.h"
129 std::function<void( UndirectedEdgeId ue,
float & collapseErrorSq, Vector3f & collapsePos )>
adjustCollapse;
133 std::function<void( EdgeId del, EdgeId rem )>
onEdgeDel;
210[[nodiscard]]
MRMESH_API QuadraticForm3f
computeFormAtVertex(
const MeshPart & mp, VertId v,
float stabilizer,
bool angleWeigted,
const UndirectedEdgeBitSet * creases =
nullptr );
306 std::function<bool( EdgeId edgeToCollapse,
const Vector3f& newEdgeOrgPos )>
preCollapse;
#define MRMESH_API
Definition MRMeshFwd.h:80
Definition MRObjectMesh.h:14
std::vector<T>-like container that requires specific indexing type,
Definition MRVector.h:23
std::function< bool(float)> ProgressCallback
Definition MRMeshFwd.h:753
DecimateStrategy
Defines the order of edge collapses inside Decimate algorithm.
Definition MRMeshDecimate.h:22
bool remesh(Mesh &mesh, const RemeshSettings &settings)
Splits too long and eliminates too short edges from the mesh.
DecimateResult decimateObjectMeshData(ObjectMeshData &data, const DecimateSettings &settings)
Vector< QuadraticForm3f, VertId > computeFormsAtVertices(const MeshPart &mp, float stabilizer, bool angleWeigted, const UndirectedEdgeBitSet *creases=nullptr)
Computes quadratic forms at every vertex of mesh part before decimation.
QuadraticForm3f 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.
bool resolveMeshDegenerations(Mesh &mesh, const ResolveMeshDegenSettings &settings={})
Removes degenerate triangles in a mesh by calling decimateMesh function with appropriate settings.
std::optional< ObjectMeshData > makeDecimatedObjectMeshData(const ObjectMesh &obj, const DecimateSettings &settings, DecimateResult *outRes=nullptr)
returns the data of decimated mesh given ObjectMesh (which remains unchanged) and decimation paramete...
DecimateResult decimateMesh(Mesh &mesh, const DecimateSettings &settings={})
Performs mesh simplification in mesh region according to the settings.
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...
@ MinimizeError
the next edge to collapse will be the one that introduced minimal error to the surface
Definition MRMeshDecimate.h:23
@ ShortestEdgeFirst
the next edge to collapse will be the shortest one
Definition MRMeshDecimate.h:24
std::function< bool(EdgeId edgeToCollapse, const Vector3f &newEdgeOrgPos)> PreCollapseCallback
Definition MRMeshFwd.h:573
HashMap< UndirectedEdgeId, UndirectedEdgeId > UndirectedEdgeHashMap
Definition MRMeshFwd.h:613
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Results of MR::decimateMesh.
Definition MRMeshDecimate.h:175
int vertsDeleted
Number deleted verts. Same as the number of performed collapses.
Definition MRMeshDecimate.h:176
int facesDeleted
Definition MRMeshDecimate.h:177
float errorIntroduced
Definition MRMeshDecimate.h:182
bool cancelled
whether the algorithm was cancelled by the callback
Definition MRMeshDecimate.h:184
Parameters structure for MR::decimateMesh.
Definition MRMeshDecimate.h:35
UndirectedEdgeBitSet * notFlippable
Edges specified by this bit-set will never be flipped, but they can be collapsed or replaced during c...
Definition MRMeshDecimate.h:82
bool collapseNearNotFlippable
Definition MRMeshDecimate.h:86
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 MRMeshDecimate.h:129
bool angleWeightedDistToPlane
Definition MRMeshDecimate.h:66
bool packMesh
whether to pack mesh at the end
Definition MRMeshDecimate.h:143
int maxDeletedFaces
Limit on the number of deleted faces.
Definition MRMeshDecimate.h:76
PreCollapseCallback preCollapse
The user can provide this optional callback that is invoked immediately before edge collapse;.
Definition MRMeshDecimate.h:119
UndirectedEdgeHashMap * twinMap
Definition MRMeshDecimate.h:94
float maxBdShift
Maximal shift of a boundary during one edge collapse.
Definition MRMeshDecimate.h:48
float criticalTriAspectRatio
Definition MRMeshDecimate.h:55
bool decimateBetweenParts
Definition MRMeshDecimate.h:154
DecimateStrategy strategy
Definition MRMeshDecimate.h:36
int minFacesInPart
minimum number of faces in one subdivision part for ( subdivideParts > 1 ) mode
Definition MRMeshDecimate.h:162
std::vector< FaceBitSet > * partFaces
Definition MRMeshDecimate.h:159
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 MRMeshDecimate.h:140
int subdivideParts
Definition MRMeshDecimate.h:150
FaceBitSet * region
Region on mesh to be decimated, it is updated during the operation.
Definition MRMeshDecimate.h:79
ProgressCallback progressCallback
callback to report algorithm progress and cancel it by user request
Definition MRMeshDecimate.h:146
float stabilizer
Definition MRMeshDecimate.h:62
float maxError
Definition MRMeshDecimate.h:42
int maxDeletedVertices
Limit on the number of deleted vertices.
Definition MRMeshDecimate.h:73
VertBitSet * bdVerts
Definition MRMeshDecimate.h:107
float tinyEdgeLength
edges not longer than this value will be collapsed even if it results in appearance of a triangle wit...
Definition MRMeshDecimate.h:58
bool optimizeVertexPos
Definition MRMeshDecimate.h:70
float maxEdgeLen
Maximal possible edge length created during decimation.
Definition MRMeshDecimate.h:45
UndirectedEdgeBitSet * edgesToCollapse
Definition MRMeshDecimate.h:90
bool touchNearBdEdges
Whether to allow collapsing or flipping edges having at least one vertex on (region) boundary.
Definition MRMeshDecimate.h:97
float maxAngleChange
Definition MRMeshDecimate.h:111
bool touchBdVerts
Definition MRMeshDecimate.h:102
float maxTriangleAspectRatio
Maximal possible aspect ratio of a triangle introduced during decimation.
Definition MRMeshDecimate.h:51
std::function< void(EdgeId del, EdgeId rem)> onEdgeDel
Definition MRMeshDecimate.h:133
mesh and its per-element attributes for ObjectMeshHolder
Definition MRObjectMeshData.h:17
Definition MRMeshDecimate.h:260
bool finalRelaxNoShrinkage
if true prevents the surface from shrinkage after many iterations
Definition MRMeshDecimate.h:285
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 MRMeshDecimate.h:299
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 MRMeshDecimate.h:297
float targetEdgeLen
Definition MRMeshDecimate.h:263
int maxEdgeSplits
Maximum number of edge splits allowed during subdivision.
Definition MRMeshDecimate.h:265
bool useCurvature
Definition MRMeshDecimate.h:276
bool projectOnOriginalMesh
Definition MRMeshDecimate.h:295
float maxAngleChangeAfterFlip
Improves local mesh triangulation by doing edge flips if it does not change dihedral angle more than ...
Definition MRMeshDecimate.h:267
FaceBitSet * region
Region on mesh to be changed, it is updated during the operation.
Definition MRMeshDecimate.h:287
float maxBdShift
Definition MRMeshDecimate.h:273
ProgressCallback progressCallback
callback to report algorithm progress and cancel it by user request
Definition MRMeshDecimate.h:308
bool frozenBoundary
Definition MRMeshDecimate.h:270
int finalRelaxIters
Definition MRMeshDecimate.h:283
std::function< bool(EdgeId edgeToCollapse, const Vector3f &newEdgeOrgPos)> preCollapse
The user can provide this optional callback that is invoked immediately before edge collapse;.
Definition MRMeshDecimate.h:306
bool packMesh
whether to pack mesh at the end
Definition MRMeshDecimate.h:292
UndirectedEdgeBitSet * notFlippable
Definition MRMeshDecimate.h:290
float maxSplittableTriAspectRatio
Definition MRMeshDecimate.h:280
Definition MRMeshDecimate.h:226
float maxAngleChange
Permit edge flips if it does not change dihedral angle more than on this value.
Definition MRMeshDecimate.h:234
float maxDeviation
maximum permitted deviation from the original surface
Definition MRMeshDecimate.h:228
FaceBitSet * region
degenerations will be fixed only in given region, which is updated during the processing
Definition MRMeshDecimate.h:245
float criticalAspectRatio
Definition MRMeshDecimate.h:238
float tinyEdgeLength
edges not longer than this value will be collapsed ignoring normals and aspect ratio checks
Definition MRMeshDecimate.h:231
float stabilizer
Definition MRMeshDecimate.h:242