Mesh.laplacian_matrix
- Mesh.laplacian_matrix(rtype='array')[source]
Compute the Laplacian matrix of the mesh.
- Parameters:
- rtypeLiteral[‘array’, ‘csc’, ‘csr’, ‘coo’, ‘list’], optional
Format of the result.
- Returns:
- array-like
The Laplacian matrix.
Notes
The
uniform Laplacian matrix of a mesh with vertices and edges is defined as follows [1]with
the degree of vertex .Therefore, the uniform Laplacian of a vertex
points to the centroid of its neighboring vertices.References
[1]Nealen A., Igarashi T., Sorkine O. and Alexa M. Laplacian Mesh Optimization.
Examples
>>> from compas.datastructures import Mesh >>> mesh = Mesh.from_polyhedron(6) >>> L = mesh.laplacian_matrix(rtype='array') >>> type(L) <class 'numpy.ndarray'>
>>> from numpy import asarray >>> xyz = asarray(mesh.vertices_attributes('xyz')) >>> L = mesh.laplacian_matrix(mesh) >>> d = L.dot(xyz)