Understanding 3D Coordinate Transformations (SO(3))
In spatial technology, an object's spatial pose consists of 6 degrees of freedom (6DoF): 3 translational coordinates $(X, Y, Z)$ and 3 rotational degrees of freedom.
Under the Tait-Bryan Z-Y-X convention (standard in aviation, maritime, and autonomous vehicles), an orientation is produced by applying three consecutive rotations:
- Yaw (ψ) around the original Z-axis (heading / azimuth)
- Pitch (θ) around the newly rotated Y'-axis (elevation / tilt)
- Roll (φ) around the final X''-axis (bank angle)
R = R_z(ψ) · R_y(θ) · R_x(φ)
R[0][0] = cosθ cosψ
R[0][1] = sinφ sinθ cosψ - cosφ sinψ
R[0][2] = cosφ sinθ cosψ + sinφ sinψ
R[1][0] = cosθ sinψ
R[1][1] = sinφ sinθ sinψ + cosφ cosψ
R[1][2] = cosφ sinθ sinψ - sinφ cosψ
R[2][0] = -sinθ
R[2][1] = sinφ cosθ
R[2][2] = cosφ cosθ
Why Quaternions Avoid Gimbal Lock
When pitch reaches ±90° (looking straight up or down), cos(θ) = 0, causing the roll and yaw axes to align. The system loses one degree of rotational freedom—a mathematical singularity known as Gimbal Lock.
Quaternions (q = [qw, qx, qy, qz]) represent rotations as a 4-dimensional hypercomplex number on a unit 3-sphere (S3). Because they do not rely on successive coordinate axis projections, quaternions are immune to gimbal lock and are used universally in ROS, Unity, Unreal Engine, and spacecraft attitude control.