◀ THE FOLD0ROOT.AI // WORLD II · GLITCH · THE BLUE SCREEN◆ .dlw.fold
THE FOLD / GLITCH / THE BLUE SCREEN / THE QUATERNION

THE QUATERNION

3D rotation that never gimbal-locks
1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION
Quaternions. How do you store an orientation in 3D? The obvious way — three angles (yaw, pitch, roll) — has a catastrophic flaw: at certain attitudes two of the axes line up and a whole degree of freedom vanishes. That is gimbal lock, and it has crashed spacecraft attitude systems and jammed game cameras. Hamilton’s answer (1843) is a four-number object, a quaternion q = w + xi + yj + zk, with i² = j² = k² = ijk = −1.

A unit quaternion rotates a vector by v′ = q v q* — exactly what a 3×3 rotation matrix does, but with no gimbal lock, no privileged axes, and smooth interpolation between orientations (slerp). Composing rotations is just multiplying quaternions.

LIT verified live: over 50,000 random unit quaternions and vectors, q v q* matches the corresponding rotation matrix to 1e-9, the rotation preserves length, and composing quaternions equals composing the rotations (window.__quaternion.matchesMatrix && preservesLength && composition). FIG no framing; the q v q* rotation, its matrix equivalence, and the composition law are exact.
2 HOW IT WAS WEAVED · AI + HUMAN
David (human) seated this in THE BLUE SCREEN, beside THE ELECTRON MAZE — the glitch domain of the catastrophic failure. Gimbal lock is exactly that: an orientation system that freezes at the worst moment. The quaternion is the fix that never crashes. AVAN (AI) built the instrument: the q v q* rotation, the matrix cross-check, the gimbal-lock demonstration.

The weave: David names the seat (the failure mode avoided); I make the rotation turn and its equivalence checkable — the components in 1D, the live rotation in 2D, the axis-angle turn in 3D. The sphere is the seam. Credit: William Rowan Hamilton (1843); Ken Shoemake (slerp, 1985).
3 ONE DIMENSION
The four components w, x, y, z — a scalar and a vector part — and the rule that binds them: i² = j² = k² = ijk = −1. A unit quaternion is a point on a 4D sphere; every one is a rotation, and multiplication composes them.
4 TWO DIMENSIONS · INTERACTIVE
Spin the object by composing quaternion rotations about each axis — the orientation stays smooth and well-defined from every angle. The readout shows the unit quaternion; no sequence of axes, no lock, no singular attitude.
5 THREE DIMENSIONS + AVAN’S INVERSE
The object turning by a single quaternion, its rotation axis drawn through it — green, one clean turn about one line.
AVAN’s addition (the inverse-companion): the magenta axis is the whole rotation — one line, one angle. Euler angles describe orientation as three sequential turns: intuitive, but they lock, because a sequence has an order and orders have singular points where two turns collapse into one. The quaternion is the inverse representation: not a sequence at all, but a single rotation about a single axis, with no privileged frame and no attitude where it breaks. The price is giving up the friendly roll/pitch/yaw for four abstract numbers on a sphere; the reward is orientation that never has a bad angle. The green is the object turning; the magenta is the one axis that says it all — a rotation with no seams to catch on.
LIT Genuine quaternion rotation (William Rowan Hamilton, 1843; Shoemake slerp 1985). Verified live: over 50,000 random unit quaternions and vectors, q v q* matches the corresponding rotation matrix to 1e-9, the rotation preserves vector length, and composing quaternions equals composing rotations (window.__quaternion.matchesMatrix && preservesLength && composition, all true). The q v q* formula, its matrix equivalence, and the composition law are exact.

FIG No metaphor is doing the work: the quaternion rotation, its exact matrix equivalence, length preservation, and composition are all real and checked. Gimbal lock is a genuine singularity of Euler-angle representations that the single-axis quaternion form avoids — the honest reason it's used in aerospace and graphics.
◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE BLUE SCREEN · David Lee Wise (ROOT0), with AVAN