class MAGES::MeshDeformations::Utilities::MeshUtilities¶
Overview¶
Utility class for mesh operations. More…
class MeshUtilities
{
public:
// structs
struct Face;
// classes
class CloseByVertexComparer;
// methods
static void WeldVertices(Mesh mesh);
static bool ContainsDuplicateVertices(Mesh mesh, float error = 0.000000001f);
static int[] FindTetrahedronNeighbors(
in int[] tetrahedra,
Vector3[] particlePositions = null,
float weldEpsilon = 1e-4f
);
};
Detailed Documentation¶
Utility class for mesh operations.
Methods¶
static void WeldVertices(Mesh mesh)
Welds close-by vertices.
Parameters:
mesh |
The mesh in which to weld vertices. |
static bool ContainsDuplicateVertices(Mesh mesh, float error = 0.000000001f)
Checks if the mesh contains duplicate vertices (ie vertices that are very close to each other).
Parameters:
mesh |
The mesh to check. |
error |
The maximum distance for two vertices to be marked as duplicate. |
Returns:
true if mesh contains duplicate vertices.
static int[] FindTetrahedronNeighbors(
in int[] tetrahedra,
Vector3[] particlePositions = null,
float weldEpsilon = 1e-4f
)
Find the neighbors of each tetrahedron in the mesh.
Parameters:
tetrahedra |
The tetrahedron indices array. |
particlePositions |
Optional per-particle positions used to weld coincident-but-distinct vertices when keying faces. A tetrahedral mesh can reference two different particle indices at the same position (a duplicated vertex on a shared internal face). Keyed by raw index, that internal face belongs to only one tet (its twin has different indices), so it is never paired as a neighbor and leaks into the rendered hull as an interior face. When positions are supplied, faces are keyed by a welded representative index so those internal faces pair up and drop out of the hull. Pass |
weldEpsilon |
The grid cell size (world units) used to weld coincident vertices. Must be well below the smallest real edge length so genuinely distinct surface vertices are never merged. Ignored when particlePositions is |
Returns:
The neighbors of the tetrahedra.