Skip to main content

Function: dihedralDegrees()

dihedralDegrees(p0, p1, p2, p3): number

Defined in: src/mobjects/molecular/ramachandran.ts:77

The signed dihedral (torsion) angle of four points, in degrees [-180, 180].

Uses the standard atan2-of-cross-products convention (the same sign as IUPAC backbone torsions). Given the three bond vectors b1 = p1 - p0, b2 = p2 - p1 and b3 = p3 - p2, the angle is atan2((n1 × b2̂) · n2, n1 · n2) where n1 = b1 × b2 and n2 = b2 × b3.

Parameters​

p0​

Vector3Tuple

The first point.

p1​

Vector3Tuple

The second point (start of the central bond).

p2​

Vector3Tuple

The third point (end of the central bond).

p3​

Vector3Tuple

The fourth point.

Returns​

number

The dihedral angle in degrees, or NaN if the central bond or either plane is degenerate (collinear points).