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

  • precision (str (None)) – A formatting option that specifies the precision of the individual numbers in the string (truncation after the decimal point). Supported values are any float precision, or decimal integer ('d'). Default is '3f'.

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