Expand description
Rotations in two and three dimensions: matrices, axis-angle, Euler sequences, and composable rotation types.
Rotation3 stores a unit Quaternion, so composition is cheap and stays normalised, and
converts to and from rotation matrices, axis-angle and any of the twelve Euler sequences.
Matrices are row-major [[f64; 3]; 3] acting on column vectors. Euler sequences are
intrinsic: Rotation3::from_euler(XYZ, [a, b, c]) rotates by a about X, then by b about
the new Y, then by c about the newest Z, i.e. R = Rx(a) Ry(b) Rz(c).
See the book entry Rotations, Euler angles and quaternions.
Structs§
- Euler
Sequence - An intrinsic Euler-angle sequence: three axes where consecutive axes differ. Sequences whose first and last axes coincide (XYX, …) are “proper” Euler angles; the others (XYZ, …) are Tait-Bryan angles.
- Rotation2
- A rotation in the plane about the origin.
- Rotation3
- A rotation in three dimensions, stored as a unit quaternion.
Enums§
- Axis
- A coordinate axis.
Constants§
Functions§
- is_
rotation_ matrix - Whether
mis orthogonal with determinant +1 withintol. - mat3_
apply - Matrix-vector product.
- mat3_
determinant - mat3_
mul - Matrix product
a * b. - mat3_
transpose - nearest_
rotation_ matrix - The rotation matrix closest (in Frobenius norm) to
m, by Newton iteration for the polar factor. Useful to clean up a matrix that has drifted after many multiplications. ReturnsNoneifmis singular or has a negative determinant (is not near a proper rotation). - rotation_
matrix_ axis_ angle - Rodrigues’ formula: the matrix of a rotation by
angleaboutaxis(normalised internally; a zero axis gives the identity). - rotation_
matrix_ x - Rotation about the X axis by
angleradians. - rotation_
matrix_ y - Rotation about the Y axis by
angleradians. - rotation_
matrix_ z - Rotation about the Z axis by
angleradians.
Type Aliases§
- Matrix3
- A 3×3 matrix in row-major order.