mesh_add_vertex_to_face_edge

compas.datastructures.mesh_add_vertex_to_face_edge(mesh, key, fkey, v)[source]

Add an existing vertex of the mesh to an existing face.

Parameters
  • mesh (compas.datastructures.Mesh) – The mesh data structure.

  • key (int) – The identifier of the vertex.

  • fkey (int) – The identifier of the face.

  • v (int) – The identifier of the vertex before which the new vertex should be added.

Returns

None

Notes

The algorithm is merely there for convenience. It does not check if the resulting mesh is still valid.

Examples

Consider the following points and one face definition and the resulting mesh.

>>> from compas.datastructures import Mesh
>>> points = [[0.0, 0.0, 0.0], [1.0, 0.0, 0.0], [1.0, 1.0, 0.0], [0.0, 1.0, 0.0], [0.5, 0.0, 0.0]]
>>> faces = [[0, 1, 2, 3]]
>>> mesh = Mesh.from_vertices_and_faces(points, faces)
>>> len(mesh.face_vertices(0))
4
>>> mesh.vertex_degree(4)
0

To add the isolated vertex to the single mesh face

>>> mesh_add_vertex_to_face_edge(mesh, 4, 0, 1)
>>> len(mesh.face_vertices(0))
5
>>> mesh.vertex_degree(4)
2