MeshLib C++ Docs
Loading...
Searching...
No Matches
MRMesh/MRMeshSubdivide.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRMeshFwd.h"
5#include "MRExpected.h"
6#include "MRConstants.h"
7#include <cfloat>
8#include <functional>
9
10namespace MR
11{
12
16
18{
20 float maxEdgeLen = 0;
21
23 int maxEdgeSplits = 1000;
24
27
29 float maxAngleChangeAfterFlip = FLT_MAX;
30
34 float criticalAspectRatioFlip = 1000.0f;
35
37 FaceBitSet * region = nullptr;
38
40 UndirectedEdgeBitSet* notFlippable = nullptr;
41
43 VertBitSet * newVerts = nullptr;
44
47 bool subdivideBorder = true;
48
51
56
59 bool smoothMode = false;
60
63 float minSharpDihedralAngle = PI_F / 6; // 30 degrees
64
67
69 std::function<bool(EdgeId e)> beforeEdgeSplit;
70
72 std::function<void(VertId)> onVertCreated;
73
75 std::function<void(EdgeId e1, EdgeId e)> onEdgeSplit;
76
79};
80
83MRMESH_API int subdivideMesh( Mesh & mesh, const SubdivideSettings & settings = {} );
84
87[[nodiscard]] MRMESH_API Expected<Mesh> copySubdividePackMesh( const MeshPart & mp, float voxelSize, const ProgressCallback & cb = {} );
88
90
91} //namespace MR
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:79
std::function< bool(float)> ProgressCallback
Definition MRMesh/MRMeshFwd.h:626
MRMESH_API Expected< Mesh > copySubdividePackMesh(const MeshPart &mp, float voxelSize, const ProgressCallback &cb={})
MRMESH_API int subdivideMesh(Mesh &mesh, const SubdivideSettings &settings={})
tl::expected< T, E > Expected
Definition MRExpected.h:59
Definition MRMesh/MRMesh.h:23
Definition MRMesh/MRMeshSubdivide.h:18
float maxTriAspectRatio
The subdivision stops as soon as all triangles (in the region) have aspect ratio below or equal to th...
Definition MRMesh/MRMeshSubdivide.h:50
float maxEdgeLen
Subdivision is stopped when all edges inside or on the boundary of the region are not longer than thi...
Definition MRMesh/MRMeshSubdivide.h:20
std::function< bool(EdgeId e)> beforeEdgeSplit
this function is called each time edge (e) is going to split, if it returns false then this split wil...
Definition MRMesh/MRMeshSubdivide.h:69
bool projectOnOriginalMesh
if true, then every new vertex will be projected on the original mesh (before smoothing)
Definition MRMesh/MRMeshSubdivide.h:66
float minSharpDihedralAngle
Definition MRMesh/MRMeshSubdivide.h:63
FaceBitSet * region
Region on mesh to be subdivided, it is updated during the operation.
Definition MRMesh/MRMeshSubdivide.h:37
bool smoothMode
Definition MRMesh/MRMeshSubdivide.h:59
float criticalAspectRatioFlip
Definition MRMesh/MRMeshSubdivide.h:34
bool subdivideBorder
Definition MRMesh/MRMeshSubdivide.h:47
std::function< void(VertId)> onVertCreated
this function is called each time a new vertex has been created, but before the ring is made Delone
Definition MRMesh/MRMeshSubdivide.h:72
float maxAngleChangeAfterFlip
Improves local mesh triangulation by doing edge flips if it does not change dihedral angle more than ...
Definition MRMesh/MRMeshSubdivide.h:29
UndirectedEdgeBitSet * notFlippable
Edges specified by this bit-set will never be flipped, but they can be split so it is updated during ...
Definition MRMesh/MRMeshSubdivide.h:40
ProgressCallback progressCallback
callback to report algorithm progress and cancel it by user request
Definition MRMesh/MRMeshSubdivide.h:78
float maxSplittableTriAspectRatio
Definition MRMesh/MRMeshSubdivide.h:55
float maxDeviationAfterFlip
Improves local mesh triangulation by doing edge flips if it does not make too big surface deviation.
Definition MRMesh/MRMeshSubdivide.h:26
VertBitSet * newVerts
New vertices appeared during subdivision will be added here.
Definition MRMesh/MRMeshSubdivide.h:43
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/MRMeshSubdivide.h:75
int maxEdgeSplits
Maximum number of edge splits allowed.
Definition MRMesh/MRMeshSubdivide.h:23