MeshLib Documentation
Loading...
Searching...
No Matches
Mesh Relax

Classes

struct  MR::MeshRelaxParams
 
struct  MR::MeshEqualizeTriAreasParams
 
struct  MR::MeshApproxRelaxParams
 

Functions

MRMESH_API bool MR::relax (Mesh &mesh, const MeshRelaxParams &params={}, ProgressCallback cb={})
 
MRMESH_API Vector3f MR::vertexPosEqualNeiAreas (const Mesh &mesh, VertId v, bool noShrinkage)
 
MRMESH_API bool MR::equalizeTriAreas (Mesh &mesh, const MeshEqualizeTriAreasParams &params={}, ProgressCallback cb={})
 
MRMESH_API bool MR::relaxKeepVolume (Mesh &mesh, const MeshRelaxParams &params={}, ProgressCallback cb={})
 
MRMESH_API bool MR::relaxApprox (Mesh &mesh, const MeshApproxRelaxParams &params={}, ProgressCallback cb={})
 
MRMESH_API void MR::removeSpikes (Mesh &mesh, int maxIterations, float minSumAngle, const VertBitSet *region=nullptr)
 applies at most given number of relaxation iterations the spikes detected by given threshold
 
MRMESH_API void MR::smoothRegionBoundary (Mesh &mesh, const FaceBitSet &regionFaces, int numIters=4)
 
MRMESH_API void MR::hardSmoothTetrahedrons (Mesh &mesh, const VertBitSet *region=nullptr)
 move all region vertices with exactly three neighbor vertices in the center of the neighbors
 

Detailed Description

Function Documentation

◆ equalizeTriAreas()

MRMESH_API bool MR::equalizeTriAreas ( Mesh & mesh,
const MeshEqualizeTriAreasParams & params = {},
ProgressCallback cb = {} )

applies given number of iterations with movement toward vertexPosEqualNeiAreas() to the whole mesh ( or some region if it is specified )

Returns
true if the operation completed successfully, and false if it was interrupted by the progress callback.

◆ hardSmoothTetrahedrons()

MRMESH_API void MR::hardSmoothTetrahedrons ( Mesh & mesh,
const VertBitSet * region = nullptr )

move all region vertices with exactly three neighbor vertices in the center of the neighbors

◆ relax()

MRMESH_API bool MR::relax ( Mesh & mesh,
const MeshRelaxParams & params = {},
ProgressCallback cb = {} )

applies given number of relaxation iterations to the whole mesh ( or some region if it is specified )

Returns
true if was finished successfully, false if was interrupted by progress callback

◆ relaxApprox()

MRMESH_API bool MR::relaxApprox ( Mesh & mesh,
const MeshApproxRelaxParams & params = {},
ProgressCallback cb = {} )

applies given number of relaxation iterations to the whole mesh ( or some region if it is specified ) approx neighborhoods

Returns
true if the operation completed successfully, and false if it was interrupted by the progress callback.

◆ relaxKeepVolume()

MRMESH_API bool MR::relaxKeepVolume ( Mesh & mesh,
const MeshRelaxParams & params = {},
ProgressCallback cb = {} )

applies given number of relaxation iterations to the whole mesh ( or some region if it is specified )
do not really keeps volume but tries hard

Returns
true if the operation completed successfully, and false if it was interrupted by the progress callback.

◆ removeSpikes()

MRMESH_API void MR::removeSpikes ( Mesh & mesh,
int maxIterations,
float minSumAngle,
const VertBitSet * region = nullptr )

applies at most given number of relaxation iterations the spikes detected by given threshold

◆ smoothRegionBoundary()

MRMESH_API void MR::smoothRegionBoundary ( Mesh & mesh,
const FaceBitSet & regionFaces,
int numIters = 4 )

given a region of faces on the mesh, moves boundary vertices of the region to make the region contour much smoother with minor optimization of mesh topology near region boundary;

Parameters
numIters>= 1 how many times to run the algorithm to achieve a better quality, solution is typically oscillates back and forth so even number of iterations is recommended

◆ vertexPosEqualNeiAreas()

MRMESH_API Vector3f MR::vertexPosEqualNeiAreas ( const Mesh & mesh,
VertId v,
bool noShrinkage )
nodiscard

computes position of a vertex, when all neighbor triangles have almost equal areas, more precisely it minimizes sum_i (area_i)^2 by adjusting the position of this vertex only