MeshLib C# Docs
Loading...
Searching...
No Matches
MR.DecimateSettings Struct Reference

Parameters structure for MR.decimateMesh. More...

Inheritance diagram for MR.DecimateSettings:

Public Member Functions

unsafe DecimateSettings ()
 Constructs an empty (default-constructed) instance.
unsafe DecimateSettings (MR.DecimateStrategy strategy, float maxError, float maxEdgeLen, float maxBdShift, float maxTriangleAspectRatio, float criticalTriAspectRatio, float tinyEdgeLength, float stabilizer, bool angleWeightedDistToPlane, bool optimizeVertexPos, int maxDeletedVertices, int maxDeletedFaces, MR.FaceBitSet? region, MR.UndirectedEdgeBitSet? notFlippable, bool collapseNearNotFlippable, MR.UndirectedEdgeBitSet? edgesToCollapse, MR.Phmap.FlatHashMap_MRUndirectedEdgeId_MRUndirectedEdgeId? twinMap, bool touchNearBdEdges, bool touchBdVerts, MR.VertBitSet? bdVerts, float maxAngleChange, MR.Std._ByValue_Function_BoolFuncFromMREdgeIdConstMRVector3fRef preCollapse, MR.Std._ByValue_Function_VoidFuncFromMRUndirectedEdgeIdFloatRefMRVector3fRef adjustCollapse, MR.Std._ByValue_Function_VoidFuncFromMREdgeIdMREdgeId onEdgeDel, MR.Vector_MRQuadraticForm3f_MRVertId? vertForms, bool packMesh, MR.Std._ByValue_Function_BoolFuncFromFloat progressCallback, int subdivideParts, bool decimateBetweenParts, MR.Std.Vector_MRFaceBitSet? partFaces, int minFacesInPart)
 Constructs MR.DecimateSettings elementwise.
unsafe DecimateSettings (MR._ByValue_DecimateSettings _other)
 Generated from constructor MR.DecimateSettings.DecimateSettings.
 DecimateSettings (Const_DecimateSettings _other)
 Generated from constructor MR.DecimateSettings.DecimateSettings.
 DecimateSettings (DecimateSettings _other)
 Generated from constructor MR.DecimateSettings.DecimateSettings.
unsafe MR.DecimateSettings assign (MR._ByValue_DecimateSettings _other)
 Generated from method MR::DecimateSettings::operator=.

Properties

new unsafe ref MR.DecimateStrategy strategy [get]
new unsafe ref float maxError [get]
 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
new unsafe ref float maxEdgeLen [get]
 Maximal possible edge length created during decimation.
new unsafe ref float maxBdShift [get]
 Maximal shift of a boundary during one edge collapse.
new unsafe ref float maxTriangleAspectRatio [get]
 Maximal possible aspect ratio of a triangle introduced during decimation.
new unsafe ref float criticalTriAspectRatio [get]
 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
new unsafe ref float tinyEdgeLength [get]
 edges not longer than this value will be collapsed even if it results in appearance of a triangle with high aspect ratio
new unsafe ref float stabilizer [get]
 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.
new unsafe ref bool angleWeightedDistToPlane [get]
 if false, then quadratic error metric is equal to the sum of distances to the planes of original mesh triangles; if true, then the sum is weighted, and the weight is equal to the angle of adjacent triangle at the vertex divided on PI (to get one after summing all 3 vertices of the triangle)
new unsafe ref bool optimizeVertexPos [get]
 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
new unsafe ref int maxDeletedVertices [get]
 Limit on the number of deleted vertices.
new unsafe ref int maxDeletedFaces [get]
 Limit on the number of deleted faces.
new unsafe MR.? FaceBitSet region [get, set]
 Region on mesh to be decimated, it is updated during the operation.
new unsafe MR.? UndirectedEdgeBitSet notFlippable [get, set]
 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.
new unsafe ref bool collapseNearNotFlippable [get]
 Whether to allow collapse of edges incident to notFlippable edges, which can move vertices of notFlippable edges unless they are fixed.
new unsafe MR.? UndirectedEdgeBitSet edgesToCollapse [get, set]
 If pointer is not null, then only edges from here can be collapsed (and some nearby edges can disappear); the algorithm updates this map during collapses, removing or replacing elements.
new unsafe MR.Phmap.? FlatHashMap_MRUndirectedEdgeId_MRUndirectedEdgeId twinMap [get, set]
 if an edge present as a key in this map is flipped or collapsed, then same happens to the value-edge (with same collapse position); the algorithm updates this map during collapses, removing or replacing elements
new unsafe ref bool touchNearBdEdges [get]
 Whether to allow collapsing or flipping edges having at least one vertex on (region) boundary.
new unsafe ref bool touchBdVerts [get]
 touchBdVerts=true: allow moving and eliminating boundary vertices during edge collapses; touchBdVerts=false: allow only collapsing an edge having only one boundary vertex in that vertex, so position and count of boundary vertices do not change; this setting is ignored if touchNearBdEdges=false
new unsafe MR.? VertBitSet bdVerts [get, set]
 if touchNearBdEdges=false or touchBdVerts=false then the algorithm needs to know about all boundary vertices; if the pointer is not null then boundary vertices detection is replaced with testing values in this bit-set; the algorithm updates this set if it packs the mesh
new unsafe ref float maxAngleChange [get]
 Permit edge flips (in addition to collapsing) to improve Delone quality of the mesh if it does not change dihedral angle more than on this value (negative value prohibits any edge flips)
new unsafe MR.Std.Function_Bool_From_MREdgeId_ConstMRVector3fRef preCollapse [get, protected set]
 The user can provide this optional callback that is invoked immediately before edge collapse;.
new unsafe MR.Std.Function_Void_From_MRUndirectedEdgeId_FloatRef_MRVector3fRef adjustCollapse [get, protected set]
 The user can provide this optional callback for adjusting error introduced by this edge collapse and the collapse position.
new unsafe MR.Std.Function_Void_From_MREdgeId_MREdgeId onEdgeDel [get, protected set]
 this function is called each time edge (del) is deleted; if valid (rem) is given then dest(del) = dest(rem) and their origins are in different ends of collapsing edge, (rem) shall take the place of (del)
new unsafe MR.? Vector_MRQuadraticForm3f_MRVertId vertForms [get, set]
 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.
new unsafe ref bool packMesh [get]
 whether to pack mesh at the end
new unsafe MR.Std.Function_Bool_From_Float progressCallback [get, protected set]
 callback to report algorithm progress and cancel it by user request
new unsafe ref int subdivideParts [get]
 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); IMPORTANT: please call mesh.packOptimally() before calling decimating with subdivideParts > 1, otherwise performance will be bad.
new unsafe ref bool decimateBetweenParts [get]
 After parallel decimation of all mesh parts is done, whether to perform final decimation of whole mesh region to eliminate small edges near the border of individual parts.
new unsafe MR.Std.? Vector_MRFaceBitSet partFaces [get, set]
 if not null, then it contains the faces of each subdivision part on input, which must not overlap, and after decimation of all parts, the region inside each part is put here; decimateBetweenParts=true or packMesh=true are not compatible with this option
new unsafe ref int minFacesInPart [get]
 minimum number of faces in one subdivision part for ( subdivideParts > 1 ) mode

Detailed Description

Parameters structure for MR.decimateMesh.

See also
decimateMesh Generated from class MR.DecimateSettings. This is the const half of the class.
decimateMesh Generated from class MR.DecimateSettings. This is the non-const half of the class.

Constructor & Destructor Documentation

◆ DecimateSettings() [1/5]

unsafe MR.DecimateSettings.DecimateSettings ( )
inline

Constructs an empty (default-constructed) instance.

◆ DecimateSettings() [2/5]

unsafe MR.DecimateSettings.DecimateSettings ( MR.DecimateStrategy strategy,
float maxError,
float maxEdgeLen,
float maxBdShift,
float maxTriangleAspectRatio,
float criticalTriAspectRatio,
float tinyEdgeLength,
float stabilizer,
bool angleWeightedDistToPlane,
bool optimizeVertexPos,
int maxDeletedVertices,
int maxDeletedFaces,
MR.FaceBitSet? region,
MR.UndirectedEdgeBitSet? notFlippable,
bool collapseNearNotFlippable,
MR.UndirectedEdgeBitSet? edgesToCollapse,
MR.Phmap.FlatHashMap_MRUndirectedEdgeId_MRUndirectedEdgeId? twinMap,
bool touchNearBdEdges,
bool touchBdVerts,
MR.VertBitSet? bdVerts,
float maxAngleChange,
MR.Std._ByValue_Function_BoolFuncFromMREdgeIdConstMRVector3fRef preCollapse,
MR.Std._ByValue_Function_VoidFuncFromMRUndirectedEdgeIdFloatRefMRVector3fRef adjustCollapse,
MR.Std._ByValue_Function_VoidFuncFromMREdgeIdMREdgeId onEdgeDel,
MR.Vector_MRQuadraticForm3f_MRVertId? vertForms,
bool packMesh,
MR.Std._ByValue_Function_BoolFuncFromFloat progressCallback,
int subdivideParts,
bool decimateBetweenParts,
MR.Std.Vector_MRFaceBitSet? partFaces,
int minFacesInPart )
inline

Constructs MR.DecimateSettings elementwise.

◆ DecimateSettings() [3/5]

unsafe MR.DecimateSettings.DecimateSettings ( MR._ByValue_DecimateSettings _other)
inline

Generated from constructor MR.DecimateSettings.DecimateSettings.

◆ DecimateSettings() [4/5]

MR.DecimateSettings.DecimateSettings ( Const_DecimateSettings _other)
inline

Generated from constructor MR.DecimateSettings.DecimateSettings.

◆ DecimateSettings() [5/5]

MR.DecimateSettings.DecimateSettings ( DecimateSettings _other)
inline

Generated from constructor MR.DecimateSettings.DecimateSettings.

Member Function Documentation

◆ assign()

unsafe MR.DecimateSettings MR.DecimateSettings.assign ( MR._ByValue_DecimateSettings _other)
inline

Generated from method MR::DecimateSettings::operator=.

Property Documentation

◆ adjustCollapse

new unsafe MR.Std.Function_Void_From_MRUndirectedEdgeId_FloatRef_MRVector3fRef MR.DecimateSettings.adjustCollapse
getprotected set

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.

◆ angleWeightedDistToPlane

new unsafe ref bool MR.DecimateSettings.angleWeightedDistToPlane
get

if false, then quadratic error metric is equal to the sum of distances to the planes of original mesh triangles; if true, then the sum is weighted, and the weight is equal to the angle of adjacent triangle at the vertex divided on PI (to get one after summing all 3 vertices of the triangle)

◆ bdVerts

new unsafe MR.? VertBitSet MR.DecimateSettings.bdVerts
getset

if touchNearBdEdges=false or touchBdVerts=false then the algorithm needs to know about all boundary vertices; if the pointer is not null then boundary vertices detection is replaced with testing values in this bit-set; the algorithm updates this set if it packs the mesh

◆ collapseNearNotFlippable

new unsafe ref bool MR.DecimateSettings.collapseNearNotFlippable
get

Whether to allow collapse of edges incident to notFlippable edges, which can move vertices of notFlippable edges unless they are fixed.

◆ criticalTriAspectRatio

new unsafe ref float MR.DecimateSettings.criticalTriAspectRatio
get

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

◆ decimateBetweenParts

new unsafe ref bool MR.DecimateSettings.decimateBetweenParts
get

After parallel decimation of all mesh parts is done, whether to perform final decimation of whole mesh region to eliminate small edges near the border of individual parts.

◆ edgesToCollapse

new unsafe MR.? UndirectedEdgeBitSet MR.DecimateSettings.edgesToCollapse
getset

If pointer is not null, then only edges from here can be collapsed (and some nearby edges can disappear); the algorithm updates this map during collapses, removing or replacing elements.

◆ maxAngleChange

new unsafe ref float MR.DecimateSettings.maxAngleChange
get

Permit edge flips (in addition to collapsing) to improve Delone quality of the mesh if it does not change dihedral angle more than on this value (negative value prohibits any edge flips)

◆ maxBdShift

new unsafe ref float MR.DecimateSettings.maxBdShift
get

Maximal shift of a boundary during one edge collapse.

◆ maxDeletedFaces

new unsafe ref int MR.DecimateSettings.maxDeletedFaces
get

Limit on the number of deleted faces.

◆ maxDeletedVertices

new unsafe ref int MR.DecimateSettings.maxDeletedVertices
get

Limit on the number of deleted vertices.

◆ maxEdgeLen

new unsafe ref float MR.DecimateSettings.maxEdgeLen
get

Maximal possible edge length created during decimation.

◆ maxError

new unsafe ref float MR.DecimateSettings.maxError
get

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

◆ maxTriangleAspectRatio

new unsafe ref float MR.DecimateSettings.maxTriangleAspectRatio
get

Maximal possible aspect ratio of a triangle introduced during decimation.

◆ minFacesInPart

new unsafe ref int MR.DecimateSettings.minFacesInPart
get

minimum number of faces in one subdivision part for ( subdivideParts > 1 ) mode

◆ notFlippable

new unsafe MR.? UndirectedEdgeBitSet MR.DecimateSettings.notFlippable
getset

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.

◆ onEdgeDel

new unsafe MR.Std.Function_Void_From_MREdgeId_MREdgeId MR.DecimateSettings.onEdgeDel
getprotected set

this function is called each time edge (del) is deleted; if valid (rem) is given then dest(del) = dest(rem) and their origins are in different ends of collapsing edge, (rem) shall take the place of (del)

◆ optimizeVertexPos

new unsafe ref bool MR.DecimateSettings.optimizeVertexPos
get

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

◆ packMesh

new unsafe ref bool MR.DecimateSettings.packMesh
get

whether to pack mesh at the end

◆ partFaces

new unsafe MR.Std.? Vector_MRFaceBitSet MR.DecimateSettings.partFaces
getset

if not null, then it contains the faces of each subdivision part on input, which must not overlap, and after decimation of all parts, the region inside each part is put here; decimateBetweenParts=true or packMesh=true are not compatible with this option

◆ preCollapse

new unsafe MR.Std.Function_Bool_From_MREdgeId_ConstMRVector3fRef MR.DecimateSettings.preCollapse
getprotected set

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

new unsafe MR.Std.Function_Bool_From_Float MR.DecimateSettings.progressCallback
getprotected set

callback to report algorithm progress and cancel it by user request

◆ region

new unsafe MR.? FaceBitSet MR.DecimateSettings.region
getset

Region on mesh to be decimated, it is updated during the operation.

◆ stabilizer

new unsafe ref float MR.DecimateSettings.stabilizer
get

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.

◆ strategy

new unsafe ref MR.DecimateStrategy MR.DecimateSettings.strategy
get

◆ subdivideParts

new unsafe ref int MR.DecimateSettings.subdivideParts
get

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); IMPORTANT: please call mesh.packOptimally() before calling decimating with subdivideParts > 1, otherwise performance will be bad.

◆ tinyEdgeLength

new unsafe ref float MR.DecimateSettings.tinyEdgeLength
get

edges not longer than this value will be collapsed even if it results in appearance of a triangle with high aspect ratio

◆ touchBdVerts

new unsafe ref bool MR.DecimateSettings.touchBdVerts
get

touchBdVerts=true: allow moving and eliminating boundary vertices during edge collapses; touchBdVerts=false: allow only collapsing an edge having only one boundary vertex in that vertex, so position and count of boundary vertices do not change; this setting is ignored if touchNearBdEdges=false

◆ touchNearBdEdges

new unsafe ref bool MR.DecimateSettings.touchNearBdEdges
get

Whether to allow collapsing or flipping edges having at least one vertex on (region) boundary.

◆ twinMap

new unsafe MR.Phmap.? FlatHashMap_MRUndirectedEdgeId_MRUndirectedEdgeId MR.DecimateSettings.twinMap
getset

if an edge present as a key in this map is flipped or collapsed, then same happens to the value-edge (with same collapse position); the algorithm updates this map during collapses, removing or replacing elements

◆ vertForms

new unsafe MR.? Vector_MRQuadraticForm3f_MRVertId MR.DecimateSettings.vertForms
getset

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.


The documentation for this struct was generated from the following file: