trimesh_harmonic

trimesh_harmonic(M)[source]

Compute the harmonic parametrisation of a triangle mesh within a fixed circular boundary.

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.off

Examples

>>> 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_harmonic(M)
>>> for key in mesh.vertices():
...     mesh_uv.vertex_attributes(key, 'xy', uv[key])
...
>>>