Contents · Physics Engines
Part 0 · Orientation
Part 1 · Mathematical Foundations
- Rotations: SO(3), Quaternions, and the Exponential Map
- Spatial Algebra: Twists, Wrenches, and se(3)
- Rigid-Body Dynamics: Inertia and the Mass Matrix
- Maximal vs Minimal Coordinates
Part 2 · Equations of Motion
Part 3 · Time Integration
Part 4 · Collision Detection
Part 5 · Contact & Constraints
Part 6 · Constraint Solvers
Part 7 · Position-Based Dynamics
Part 8 · GPU & Parallelism
Part 9 · Differentiable Simulation
Part 1 · Mathematical Foundations
Rotations: SO(3), Quaternions, and the Exponential Map
Position is easy: three numbers, add them, done. Orientation is the part of rigid-body state that needs its own chapter, because the set of 3D rotations is a curved space, not a vector space.
The rotation group
A 3D rotation is a matrix that preserves lengths and handedness:
These matrices form the group . It is 3-dimensional (a rotation has three degrees of freedom) but it lives inside with six constraints, and crucially it is not flat: you cannot add two rotations and get a rotation. That single fact is why every representation below is a compromise.
Four ways to store a rotation
- Euler angles (). Three numbers, minimal, and intuitive. But the map from angles to is singular: at certain angles two of the axes line up and a degree of freedom vanishes. That is gimbal lock, below.
- Rotation matrix. Nine numbers, no singularities, composition is a matrix multiply, but you must fight numerical drift away from .
- Unit quaternion . Four numbers, one constraint , no gimbal lock, cheap to compose and to renormalize. This is what engines store internally. (It double-covers : and are the same rotation.)
- Axis-angle / exponential coordinates . Three numbers again, but interpreted as "rotate by about axis ." This is the natural home for angular velocity and for integrating rotation.
Angular velocity and the exponential map
Angular velocity is not the time derivative of any of those storage formats directly. It relates to the matrix through the skew-symmetric operator :
The skew-symmetric matrices are the Lie algebra , the flat tangent space at the identity. The exponential map takes a vector there back onto the group,
which is just Rodrigues' formula. This is how an engine advances orientation without leaving the manifold: integrate in the flat algebra, then map back with . For quaternions the same step is (quaternion product), followed by renormalizing.
Gimbal lock, live
The clearest way to feel why Euler angles are dangerous is to watch three gimbals collapse. Drag pitch toward :
Drag the scene to orbit.
An engine that stored orientation as Euler angles would hit this singularity in the middle of a simulation: near it, small angular velocities demand enormous angle rates, and the integrator explodes. That is why the state you actually find inside MuJoCo, PhysX, or Bullet is a unit quaternion, and why the integrator works in through the exponential map. The next piece packages this together with linear motion into the 6D spatial-vector notation the articulated-body algorithms are written in.