Removes duplicate vertices.

Namespace: DigitalRune.Geometry.Meshes
Assembly: DigitalRune.Geometry (in DigitalRune.Geometry.dll) Version: 1.9.0.0 (1.9.3.9490)

Syntax

C#
public int WeldVertices(
	float vertexPositionTolerance
)
Visual Basic
Public Function WeldVertices ( _
	vertexPositionTolerance As Single _
) As Integer
Visual C++
public:
int WeldVertices(
	float vertexPositionTolerance
)

Parameters

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

Return Value

The number of removed vertices.

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# Copy imageCopy
// 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);

Exceptions

ExceptionCondition
System..::..ArgumentOutOfRangeExceptionvertexPositionTolerance is negative or 0.

See Also