ddg.math.energies module

Module for (local) energies. All energies in this module are defined for the minimal required amount of vertices and assume some combinatorics. Energies in this module are not necessarily scalar valued or positive.

ddg.math.energies.planarity_by_diagonal_distance(p1, p2, p3, p4)[source]

Flatness energy of a quad \(P_1P_2P_3P_4\) calculate as the distance of its diagonals. A quad is planar, if its diagonals intersect.

Parameters:
p1numpy.ndarray of shape (n,)

Coordinates of P1

p2numpy.ndarray of shape (n,)

Coordinates of P2

p3numpy.ndarray of shape (n,)

Coordinates of P3

p4numpy.ndarray of shape (n,)

Coordinates of P4

Returns:
energyfloat

(signed) circularity energy

ddg.math.energies.circularity_by_angles(p1, p2, p3, p4)[source]

Circularity energy of a quad \(P_1P_2P_3P_4\) calculated by its angles. A quad is circular, if both pairs of opposite interior angles add up to \(\pi\).

Parameters:
p1numpy.ndarray of shape (n,)

Coordinates of P1

p2numpy.ndarray of shape (n,)

Coordinates of P2

p3numpy.ndarray of shape (n,)

Coordinates of P3

p4numpy.ndarray of shape (n,)

Coordinates of P4

Returns:
energynp.ndarray of shape (2,)

(signed) circularity energy

Notes

This function does not check for coplanarity.

ddg.math.energies.circularity_by_ptolemy(p1, p2, p3, p4)[source]

Circularity energy of a quad \(P_1P_2P_3P_4\) calculated by Ptolemy’s identity. A quad is circular, if

\[D_1D_2= A_1A_2 + B_1B_2,\]

where \(D_1,D_2\) are the length of the quad’s diagonals and \(A_1,A_2\) (and \(B_1,B_2\) respectively) are the length of opposing sides of the quad.

Parameters:
p1numpy.ndarray of shape (n,)

Coordinates of P1

p2numpy.ndarray of shape (n,)

Coordinates of P2

p3numpy.ndarray of shape (n,)

Coordinates of P3

p4numpy.ndarray of shape (n,)

Coordinates of P4

Returns:
energyfloat

(signed) circularity energy

Notes

This function does not check for coplanarity. This energy is numerically bad behaved since we subtract roots from each other.

ddg.math.energies.circularity_by_complex_cr(p1, p2, p3, p4)[source]

Circularity energy of a quad \(P_1P_2P_3P_4\) in the plane calculated by complex cross ratio. A quad is circular, if the complex cross ratio of its vertices is real.

Parameters:
p1numpy.ndarray of shape (2,)

Coordinates of \(P_1\)

p2numpy.ndarray of shape (2,)

Coordinates of \(P_2\)

p3numpy.ndarray of shape (2,)

Coordinates of \(P_3\)

p4numpy.ndarray of shape (2,)

Coordinates of \(P_4\)

Returns:
energyfloat

(signed) circularity energy

ddg.math.energies.isothermicity_by_dual_quads(O, A, B, C, D, E, F, G, H)[source]

Function to compute isothermicity energy of a net f locally around a vertex \(f(n1, n2)\) . If a discrete surface is isothermic, real functions \(\alpha_k\) can be defined as edge labels that factorize face cross-ratios:

\[cr(f, f_i, f_{ij}, f_j) = \frac{\alpha_i}{\alpha_j}.\]

With this the relationship of non-corresponding (parallel) diagonals of primal and Christoffel dual surface can be described as

\[f^*_j - f^*_i = (\alpha_i - \alpha_j) \frac{f_{ij}-f_i}{||f_{ij}-f_i||^2}.\]

In particular

\[\langle f^*_j - f^*_i, f_{ij}-f_i \rangle = (\alpha_i - \alpha_j).\]

This function returns the sum of the scalar products above iterating over all faces adjacent to the vertex \(f(n1, n2)\) . The sum is zero if the surface is discrete isothermic.

           D-----C-----B
           |     |     |
           |     |     |
           E-----O-----A
           |     |     |
           |     |     |
           F-----G-----H

             f(ni, nj)

where O = :math:`f(n1, n2)` .
Parameters:
O: numpy.ndarray
A: numpy.ndarray
B: numpy.ndarray
C: numpy.ndarray
D: numpy.ndarray
E: numpy.ndarray
F: numpy.ndarray
G: numpy.ndarray
H: numpy.ndarray
Returns:
float

Sum of scalar products \(\langle f^*_j - f^*_i, f_{ij}-f_i \rangle\) around vertex \(f(n1, n2)\) .

Notes

This function assumes local \(\mathbb{Z}^2\) combinatorics of the net around the vertex \(f(n1, n2)\).