trimesh_lscm
- trimesh_lscm(M)[source]
Compute the least squares conformal map of a triangle mesh.
- Parameters:
- Mtuple
A mesh represented by a list of vertices and a list of faces or by a COMPAS mesh object.
- Returns:
- array
The u, v parameters per vertex.
Notes
camelhead.off
can be downloaded from https://raw.githubusercontent.com/libigl/libigl-tutorial-data/master/camelhead.offExamples
>>> import compas_libigl as igl >>> from compas.datastructures import Mesh >>> mesh = Mesh.from_off(igl.get('camelhead.off')) >>> mesh_uv = mesh.copy() >>> mesh_uv.vertices_attribute('z', 0) >>> M = mesh.to_vertices_and_faces() >>> uv = igl.trimesh_lscm(M) >>> for key in mesh.vertices(): ... mesh_uv.vertex_attributes(key, 'xy', uv[key]) ... >>>