MeshLib C++ Docs
Loading...
Searching...
No Matches
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
25
27 int maxEdgeSplits = 1000;
28
31
33 float maxAngleChangeAfterFlip = FLT_MAX;
34
38 float criticalAspectRatioFlip = 1000.0f;
39
41 FaceBitSet * region = nullptr;
42
45 FaceBitSet * maintainRegion = nullptr;
46
48 UndirectedEdgeBitSet* notFlippable = nullptr;
49
51 VertBitSet * newVerts = nullptr;
52
55 bool subdivideBorder = true;
56
59
64
67 bool smoothMode = false;
68
71 float minSharpDihedralAngle = PI_F / 6;
72
75
77 std::function<bool(EdgeId e)> beforeEdgeSplit;
78
80 std::function<void(VertId)> onVertCreated;
81
83 std::function<void(EdgeId e1, EdgeId e)> onEdgeSplit;
84
86 ProgressCallback progressCallback;
87};
88
91MRMESH_API int subdivideMesh( Mesh & mesh, const SubdivideSettings & settings = {} );
92
96MRMESH_API int subdivideMesh( ObjectMeshData & data, const SubdivideSettings & settings );
97
100[[nodiscard]] MRMESH_API Expected<Mesh> copySubdividePackMesh( const MeshPart & mp, float voxelSize, const ProgressCallback & cb = {} );
101
103[[nodiscard]] MRMESH_API ObjectMeshData makeSubdividedObjectMeshData( const ObjectMesh & obj, const SubdivideSettings & settings );
104
106
107}
Definition MRObjectMesh.h:14
tl::expected< T, E > Expected
Definition MRExpected.h:31
MRMESH_API Expected< Mesh > copySubdividePackMesh(const MeshPart &mp, float voxelSize, const ProgressCallback &cb={})
MRMESH_API int subdivideMesh(Mesh &mesh, const SubdivideSettings &settings={})
MRMESH_API ObjectMeshData makeSubdividedObjectMeshData(const ObjectMesh &obj, const SubdivideSettings &settings)
returns the data of subdivided mesh given ObjectMesh (which remains unchanged) and subdivision parame...
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Definition MRMesh.h:23
mesh and its per-element attributes for ObjectMeshHolder
Definition MRObjectMeshData.h:17
Definition 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 MRMeshSubdivide.h:58
float maxEdgeLen
Subdivision is stopped when all edges inside or on the boundary of the region are not longer than thi...
Definition 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 MRMeshSubdivide.h:77
bool projectOnOriginalMesh
30 degrees
Definition MRMeshSubdivide.h:74
float minSharpDihedralAngle
Definition MRMeshSubdivide.h:71
FaceBitSet * region
Region on mesh to be subdivided, it is updated during the operation.
Definition MRMeshSubdivide.h:41
bool smoothMode
Definition MRMeshSubdivide.h:67
float criticalAspectRatioFlip
Definition MRMeshSubdivide.h:38
bool subdivideBorder
Definition MRMeshSubdivide.h:55
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 MRMeshSubdivide.h:80
float maxAngleChangeAfterFlip
Improves local mesh triangulation by doing edge flips if it does not change dihedral angle more than ...
Definition MRMeshSubdivide.h:33
UndirectedEdgeBitSet * notFlippable
Edges specified by this bit-set will never be flipped, but they can be split so it is updated during ...
Definition MRMeshSubdivide.h:48
FaceBitSet * maintainRegion
Definition MRMeshSubdivide.h:45
ProgressCallback progressCallback
callback to report algorithm progress and cancel it by user request
Definition MRMeshSubdivide.h:86
float maxSplittableTriAspectRatio
Definition MRMeshSubdivide.h:63
float maxDeviationAfterFlip
Improves local mesh triangulation by doing edge flips if it does not make too big surface deviation.
Definition MRMeshSubdivide.h:30
float curvaturePriority
Definition MRMeshSubdivide.h:24
VertBitSet * newVerts
New vertices appeared during subdivision will be added here.
Definition MRMeshSubdivide.h:51
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 MRMeshSubdivide.h:83
int maxEdgeSplits
Maximum number of edge splits allowed.
Definition MRMeshSubdivide.h:27