Skip to content

Tutte's Embedding

Usage

import mouette as M
mesh = M.mesh.load(args.model)
tutte = M.parametrization.TutteEmbedding(mesh, [boundary_mode], use_cotan=True, verbose=True)
tutte.run()
M.mesh.save(mesh, "tutte_model.obj")
M.mesh.save(tutte.flat_mesh, "tutte_flat.obj")

TutteEmbedding

Bases: BaseParametrization

Tutte's embedding parametrization method for a disk inside a fixed boundary. The parametrization is locally injective (Floater, 1997) provided the boundary is convex.

References
  • [1] How to draw a graph, Tutte W.T., 1963

  • [2] Parametrization and smooth approximation of surface triangulations, Floater M.S., 1997

Example

https://github.com/GCoiffier/mouette/blob/main/examples/parametrization/tutte.py

Parameters:

Name Type Description Default
mesh SurfaceMesh

the mesh to embed. Should be a surface with disk topology.

required
boundary_mode str

Shape of the boundary. Possible choices are ["square", "circle"]. Defaults to "circle".

'circle'
use_cotan bool

If True, uses cotangents as weights in the Laplacian matrix [2]. Otherwise, use Tutte's original barycentric embedding [1]. Defaults to False.

False
verbose bool

verbose mode. Defaults to False.

False

Other Parameters:

Name Type Description
save_on_corners bool

if True, the resulting uv-coordinates will be stored in an attribute on face corners. Otherwise, they are stored in an attribute on vertices. Defaults to True

custom_boundary (ndarray, optionnal)

a Nx2 array containing custom coordinates for the boundary vertices (N being the number of boundary vertices).

Attributes:

Name Type Description
uvs Attribute

an attribute containing the uv-coordinates of the parametrization

save_on_corners bool

whether the coordinates are saved as a vertex attribute or a face_corner attribute

Raises:

Type Description
InvalidArgumentValueError

if 'boundary_mode' is not "square" or "circle".

flat_mesh property

A flat representation of the mesh where uv-coordinates are copied to xy.

Returns:

Name Type Description
SurfaceMesh SurfaceMesh

the flat mesh

run()

Computes the parametrization. Result is stored in the uvs attribute

Raises:

Type Description
Exception

fails if the mesh is not a topological disk