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
  • mesh (compas.datastructures.Mesh) – A mesh object.

  • precision (str, optional) – Precision for point comparison in the form of a string formatting specifier. For example, floating point precision ('3f'), or decimal integer ('d'). Default is compas.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