🧭 2D Quaternion Rotation — Gimbal Lock & SLERP

Real Hamilton-product rotation · Numerically-verified gimbal lock · Real SLERP

Euler Angles (left)

Quaternion (right)

Quaternion Value

w1.000
x0.000
y0.000
z0.000

🧭 What It Demonstrates

This is a genuine 2D companion to the 3D quaternion simulation: every rotation on screen comes from real quaternion algebra — q = w + xi + yj + zk, real Hamilton-product multiplication, real conjugate/inverse, and real vector rotation via q·v·q⁻¹ — applied to actual 3D points that are then flattened with a fixed oblique orthographic projection for 2D display. The left cube instead uses a classic yaw-pitch-roll Euler sequence built from three literal rotation matrices, and the panel below it runs a live numerical proof of gimbal lock: at pitch = 90°, two different (yaw, roll) pairs are shown to produce the exact same rotation matrix, so one rotational degree of freedom is provably gone. The same Δ-test applied to the quaternion's axis-angle parameters produces a non-zero difference at every angle, including 90°, because axis-angle/quaternion parameterisation has no equivalent singularity. A separate SLERP mode interpolates smoothly between two independently-chosen quaternions along the shortest arc on the 4D unit hypersphere.

How to Use

Did You Know?

For the Euler sequence used here (yaw about Z, then pitch about Y, then roll about X), the combined rotation matrix at pitch = 90° reduces algebraically to a function of yaw − roll alone — the two angles become mathematically interchangeable, which is exactly what the live difference readout confirms at zero. Quaternions built directly from an axis and an angle never pass through an equivalent step, which is why every modern 3D engine stores orientation as a quaternion internally even though artists and animators still author it with Euler-style controls.