← Iris

Euler Angles
Yaw 0.0°
Pitch 0.0°
Roll 0.0°
Gimbal Lock!
Quaternion
w 1.000
x 0.000
y 0.000
z 0.000
Shape
SLERP speed 1.0s

The gimbal lock problem

Euler angles describe orientation as three sequential rotations — yaw, pitch, roll. This works until the pitch reaches ±90°, at which point the yaw and roll axes align and one degree of freedom is lost. The object appears to “seize up” at the poles. This is gimbal lock, and it’s a fundamental limitation of representing 3D rotations as three separate angle values.

Quaternions

A quaternion q = w + xi + yj + zk is a four-dimensional number. Unit quaternions (those with |q| = 1) live on the surface of a 4D hypersphere and can represent any 3D rotation without gimbal lock. To rotate a point p by quaternion q, compute q·p·q*, where q* is the conjugate. This is equivalent to a rotation matrix but composes more cleanly and interpolates more naturally.

SLERP

Spherical Linear Interpolation traces the shortest arc on the quaternion hypersphere between two orientations. Unlike interpolating Euler angles (which can take bizarre indirect paths), SLERP always produces the most natural rotation at constant angular velocity. This is why every 3D engine, from game engines to spacecraft controllers, uses quaternions internally.

The hypersphere

Unit quaternions form S³, the 3-sphere embedded in 4D space. Each point on this sphere corresponds to a unique 3D rotation — except that q and −q represent the same rotation (double cover of SO(3)). The quaternion display on the right panel shows the current rotation as coordinates on this hypersphere.


← Back to all experiments