A rotation in 3D has three degrees of freedom. Every representation is a compromise between that number and the operations you want to be cheap.
| Numbers | Constraint | Good at | Bad at | |
|---|---|---|---|---|
| Matrix | 9 | , | applying to vectors, composing | storage, staying valid under drift |
| Axis–angle | 3 | none | minimal, natural for increments | composing, singular at |
| Quaternion | 4 | composing, interpolating, stability | reading by eye, sign ambiguity | |
| Euler | 3 | none | human interfaces | everything else |
The three-number representations cannot be globally free of singularities — this is a topological fact about , not a failure of imagination — which is why the well-behaved representations carry a redundant number and a constraint.
Axis–angle to matrix (Rodrigues)
-
Split the vector into components along and across the rotation axis k. Only the perpendicular part moves.
-
The perpendicular part rotates in its plane, with k × v supplying the perpendicular direction of unit length.
-
Collect terms and write the cross product as the skew-symmetric matrix [k]ₓ. Three numbers in, a valid rotation matrix out — always, with no constraint to enforce.
You store orientations as matrices and integrate small updates over thousands of steps. What goes wrong, and what fixes it?
Show answer
Floating-point error accumulates and drifts away from orthogonality — it starts scaling and shearing slightly. Symptoms: vectors changing length under "rotation", and no longer being the inverse. Fixes, in increasing order of principle: periodic re-orthonormalisation (Gram–Schmidt or the SVD projection ); storing a quaternion and re-normalising, which is one constraint instead of six; or composing updates as , where the exponential map produces an exactly-orthogonal factor by construction.