mesh_connectivity_matrix

compas.datastructures.mesh_connectivity_matrix(mesh, rtype='array')[source]

Creates a connectivity matrix from a Mesh datastructure.

Parameters
  • mesh (Mesh) – Instance of mesh.

  • rtype (Literal[‘array’, ‘csc’, ‘csr’, ‘coo’, ‘list’], optional) – Format of the result.

Returns

array_like – Constructed connectivity matrix.

Examples

>>> from compas.datastructures import Mesh
>>> mesh = Mesh.from_polyhedron(6)
>>> C = mesh_connectivity_matrix(mesh)
>>> type(C)
<class 'numpy.ndarray'>
>>> C = mesh_connectivity_matrix(mesh, rtype='csr')
>>> xyz = asarray(mesh.vertices_attributes('xyz'))
>>> C = mesh_connectivity_matrix(mesh, rtype='csr')
>>> uv = C.dot(xyz)