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(p1, p2, p3, p4, p5, p6, p7, p8, p9)[source]

Isothermicity energy of a 2x2 grid of the quads \(P_1 P_2 P_5 P_4\), \(P_2 P_3 P_6 P_5\), \(P_4 P_5 P_8 P_7\), and \(P_5 P_6 P_9 P_8\).

Parameters:
p1numpy.ndarray(n,)

Coordinates of \(P_1\)

p2numpy.ndarray(n,)

Coordinates of \(P_2\)

p3numpy.ndarray(n,)

Coordinates of \(P_3\)

p4numpy.ndarray(n,)

Coordinates of \(P_4\)

p5numpy.ndarray(n,)

Coordinates of \(P_5\)

p6numpy.ndarray(n,)

Coordinates of \(P_6\)

p7numpy.ndarray(n,)

Coordinates of \(P_7\)

p8numpy.ndarray(n,)

Coordinates of \(P_8\)

p9numpy.ndarray(n,)

Coordinates of \(P_9\)

Returns:
energyfloat

(signed) isothermicity energy