mesh_delete_duplicate_vertices

compas.datastructures.mesh_delete_duplicate_vertices(mesh, precision=None)[source]

Cull all duplicate vertices of a mesh and sanitize affected faces.

Parameters:
meshcompas.datastructures.Mesh

A mesh object.

precisionint, optional

Precision for converting numbers to strings. Default is TOL.precision.

Returns:
None

The mesh is modified in-place.

Examples

>>> import compas
>>> from compas.datastructures import Mesh
>>> mesh = Mesh.from_obj(compas.get('faces.obj'))
>>> mesh.number_of_vertices()
36
>>> for x, y, z in mesh.vertices_attributes('xyz', keys=list(mesh.vertices())[:5]):
...     mesh.add_vertex(x=x, y=y, z=z)
...
36
37
38
39
40
>>> mesh.number_of_vertices()
41
>>> mesh_delete_duplicate_vertices(mesh)
>>> mesh.number_of_vertices()
36