Skip to content

Measuring Distortion

Utilities classes to compute distortions of elements between "real" \(xyz\)-space and "parametric" \(uv\)-space.

ParamDistortion(mesh, uv_attr='uv_coords', save_on_mesh=True, verbose=False)

Bases: Worker

Utility class to compute various distortion metrics for surface parametrization.

Initializes the distortion utility class.

Parameters:

Name Type Description Default
mesh SurfaceMesh

the supporting mesh

required
uv_attr str

the attribute name that stores the uv-coordinates on face corners. Defaults to "uv_coords".

'uv_coords'
save_on_mesh bool

If True, distortion values will be stored as attributes on the mesh. Defaults to True.

True
verbose bool

verbose mode. Defaults to False.

False

Raises:

Type Description
Exception

fails if the attribute 'uv_attr' does not exists.

conformal property

Conformal distortion, defined as \(\frac{||J||^2}{\det(J)}\)

iso property

Isometric distortion

Defined as the distance from (\(\sigma_1\), \(\sigma_2\)) to (1,1) where \(\sigma_1\) and \(\sigma_2\) are the eigenvalues of J

scale property

Scale distortion, defined as \(\frac12 (\det(J) + 1/\det(J))\)

shear property

Shear distortion

Defined as \(c1 \cdot c2\) where \(c1\) and \(c2\) are the columns of J

stretch property

Stretch distortion

Defined as the ratio \(\frac{\sigma_1}{\sigma_2}\) where \(\sigma_1\) and \(\sigma_2\) are the eigenvalues of J

summary property

Computes a summary dictionnary of all distortion values as an average over the mesh

Returns:

Name Type Description
dict dict

a dictionnary with aggregated values over the mesh

run()

Run the distortion computation.

Raises:

Type Description
Exception

fails if the mesh is not triangular.

ZeroDivisionError

if degenerated elements are present in the parametrization.

QuadQuality(mesh, save_on_mesh=True, verbose=False)

Bases: Worker

Utility class to compute various quality metrics on quad meshes

run()

Runs the distortion computation

Raises:

Type Description
Exception

fails if the mesh is not a quadmesh