Click or drag to resize
DigitalRuneTriangleMeshWeldVertices Method (Single)
Removes duplicate vertices.

Namespace: DigitalRune.Geometry.Meshes
Assembly: DigitalRune.Geometry (in DigitalRune.Geometry.dll) Version: 1.18.0.0 (1.18.2.14427)
Syntax
public int WeldVertices(
	float vertexPositionTolerance
)

Parameters

vertexPositionTolerance
Type: SystemSingle
The vertex position tolerance. If the distance between two vertices is less than this value, the vertices are merged.

Return Value

Type: Int32
The number of removed vertices.
Exceptions
ExceptionCondition
ArgumentOutOfRangeExceptionvertexPositionTolerance is negative or 0.
Remarks

Vertex welding is also called vertex shifting or vertex merging. Vertices near each other are merged to a single vertex to remove duplicate, redundant vertices.

Examples
The following examples shows how to apply vertex welding when building a complex mesh.
C#
// Building a complex triangle mesh using vertex welding.
TriangleMesh mesh = new TriangleMesh();

// Add triangles:
mesh.AddTriangle(new Triangle(v0, v1, v2), false);
mesh.AddTriangle(new Triangle(v4, v1, v0), false);
...

// After all vertices are added, remove duplicates.
mesh.WeldVertices(0.001f);
See Also