# Intrinsic distortion measurements

This post lists some useful formulas for evaluating the distortion of maps between triangle meshes. The distortions considered here are *intrinsic*, meaning they only depend on the change in triangle edge lengths. Conveniently, they also happen to have fairly simple formulas in terms of the triangle edge lengths.

### Background

There are many ways to measure the distortion of a map \(\phi : M \to N\) between surfaces. The general strategy is to compute the Jacobian \(J_\phi\), which is a \(2\times 2\) matrix, and consider different functions of its singular values \(\sigma_1, \sigma_2\). For instance, the product \(\sigma_1\sigma_2\) measures the *area distortion* of \(\phi\) (as it is simply the determinant \(\det J_\phi\)), while the ratio \(\sigma_1 / \sigma_2\) measures the amount of anisotropic stretching induced by \(\phi\). (See *e.g.* section 2 of Khodakovsky et al. [ 2003; free version] for more details.)

A piecewise-linear map between triangle meshes, deforms each triangle by a linear map, so its distortion is constant on each triangle. Below, I give some formulas for computing such per-triangle distortions *intrinsically*, that is, computing the distortions using only the lengths of the initial and deformed triangles. In each formula, I refer to the triangle's vertices as \(i, j, k\). The initial edge lenths are denoted \(\ell_{ij}, \ell_{jk}, \ell_{ki}\), and the corner angles are denoted \(\alpha_i, \alpha_j, \alpha_k\). Quantities measured after deformation are denoted \(\tilde \ell_{ij}\), *etc.*

### Area Distortion

The area distortion \(\sigma_1\sigma_2\) is simply given by the ratio of the deformed triangle's area to the original triangle's area. Using Heron's formula, one can show that the area of a triangle is given by \[\text{area}_{ijk} := \tfrac{1}{2\sqrt2}\sqrt{\left(\ell^2\right)^T \!\!\! A \ell^2},\] where \(\ell^2\) denotes the vector of squared edge lengths $(\ell_{ij}^2, \ell_{jk}^2, \ell_{ki}^2)^T$, and \(A\) is the matrix \[ A = \frac 12 \begin{pmatrix}-1 & 1 & 1 \\ 1 & -1 & 1\\ 1 & 1 & -1\end{pmatrix}.\] Hence, the area distortion is given by \[\sigma_1\sigma_2 = \sqrt{\frac{(\tilde \ell^2)^T A \tilde \ell^2}{(\ell^2)^T A \ell^2}}.\]

### Symmetrized Anisotropic Distortion

Before considering the anisotropic distortion \(\sigma_1/\sigma_2\) itself, we begin with a symmetrized version \(\frac{\sigma_1}{\sigma_2} + \frac{\sigma_2}{\sigma_1}\), which is given by a similar formula: \[ \frac{\sigma_1}{\sigma_2} + \frac{\sigma_2}{\sigma_1} = \frac{\left(\ell^2\right)^T \!\!\! A \tilde \ell^2}{\sqrt{\left(\ell^2\right)^T \!\!\! A\, \ell^2}\sqrt{(\tilde \ell^2)^T \! A \tilde \ell^2}}. \] This formula can also be written directly in terms of the angles \(\alpha_i\) as \[ \frac{\sigma_1}{\sigma_2} + \frac{\sigma_2}{\sigma_1} = \begin{pmatrix} \cot \alpha_i\\\cot\alpha_j\\\cot\alpha_k\end{pmatrix}^T A^{-1} \begin{pmatrix} \cot \tilde\alpha_i\\\cot\tilde\alpha_j\\\cot\tilde\alpha_k\end{pmatrix}, \] where \(A^{-1}\) is given by \[ A^{-1} = \begin{pmatrix} 0 & 1 & 1 \\ 1 & 0 & 1 \\ 1 & 1 & 0 \end{pmatrix}.\] The equivalence of these two expressions follows from the identity \[ \begin{pmatrix} \cot \alpha_i \\ \cot \alpha_j \\ \cot\alpha_k \end{pmatrix} = \frac {A^{-1}\ell^2} {\sqrt{\left(\tilde \ell^2\right)^T \!\!\! A \tilde \ell^2}}, \] (which can itself be derived using the law of cosines, the sine formula for area, and the definition that $\cot \alpha = \tfrac{\cos\alpha}{\sin\alpha}$.)

A derivation of the cotan formula for distortion, courtesy of Boris Springborn, can be found here, and connections to hyperbolic geometry are discussed, *e.g.*, in p.11 of Joshua Bowman's PhD thesis with John H. Hubbard.

### Anisotropic Distortion

The anisotropic distortion can easily be computed from the symmetrized anisotropic distortion by solving the quadratic equation \(y = x + \frac 1x\). Concretely, if the symmetrized distortion is given by \(d_s\), then the ordinary anisotropic distortion is given by \[ \frac{\sigma_1}{\sigma_2} = \frac 12 \left(d_s + \sqrt{d_s^2-4}\right) \]

### Other distortions

Once you have computed the distortions \(\sigma_1\sigma_2\) and \(\sigma_1 / \sigma_2\), then you can find the values of the two singular values \(\sigma_1\) and \(\sigma_2\) by multiplying and dividing the distortion values respectively. These singular values can then be used to evaluate many other measurements of distortion.

For discussion of intrinsic calculations for distortion in the context of elasticity, see Appendix B of Sassen *et al.* [2020; arxiv version]

## No comments: