# Quaternion Rotation Explorer

Interactive quaternion rotation explorer — unit quaternions, the SO(3) double cover, slerp interpolation, and gimbal lock

> Canonical page: https://elysiatools.com/en/visualizations/quaternion-rotation-explorer

- **Category:** Math

## Overview

Interactive quaternion rotation explorer rendered with Three.js — the first case in the collection devoted to a NON-commutative algebraic structure (existing geometry cases like rose-mathematics, heart-curve, cycloid-trochoid live in commutative Euclidean space). Models the quaternion algebra H={a+b·i+c·j+d·k}, i²=j²=k²=ijk=−1 (Hamilton 1843): full Hamilton-product multiplication, conjugate, inverse, norm, and normalisation; axis-angle↔quaternion (q=(cos θ/2, n·sin θ/2)); quaternion↔rotation-matrix conversion (Shepperd's branch-stable matrix→quaternion method, verified round-trip to 1e-9); ZYX aerospace Euler-angle (yaw-pitch-roll) ↔ quaternion with PRECISE gimbal-lock detection (|sin(pitch)|>0.9999 flags the singularity where yaw and roll collapse). The unit quaternions form the 3-sphere S³ and DOUBLE-COVER SO(3): q and −q give the same rotation — the 2-to-1 map SU(2)→SO(3) is why quaternions parameterise ALL of SO(3) smoothly with no singularity (the edu card is careful to state gimbal lock is an EULER-angle phenomenon, not inherent to rotation matrices or quaternions). SLERP (spherical linear interpolation) walks the shortest great-circle arc: slerp(t)=(q₀·sin((1−t)Ω)+q₁·sin(tΩ))/sin(Ω), choosing the sign so q₀·q₁≥0 (the short way, ≤180°), with a near-linear fallback when the endpoints are within 0.0005. Composition = Hamilton product (q₂⊗q₁ applies q₁ first; order matters since quaternions do not commute). Core interaction: a deliberately ASYMMETRIC 3D object (six differently-coloured faces + forward arrow + local axes) is rotated by dragging it — an arc-ball delta quaternion in CAMERA space is left-multiplied onto the current orientation, so the handle behaves like grabbing the object itself; dragging empty space orbits the camera independently (separate yaw/pitch/dist), wheel zooms. Controls: live q=(w,x,y,z), axis·angle, |q|, double-cover readouts; ZYX Euler sliders (yaw ±180°, pitch ±90°, roll ±180°) with a pulsing GIMBAL LOCK badge when the pitch singularity is hit; a slerp timeline (t slider + ▶ animate loop, set-start / set-end from current orientation, start/end quaternion readouts); a composition chain (append current, apply, clear, per-item remove). 7 presets (identity, 90° about X/Y/Z, diagonal axis, gimbal-lock demo, 180° flip). Educational content covers the algebra H and non-commutativity, the SO(3) double cover, gimbal lock as an Euler-specific singularity, slerp on S³, composition via Hamilton product, and real applications (spacecraft/satellite attitude control, IMU sensor fusion, robotics, game engines, VR head tracking, molecular docking). Verified by 213 model tests (i·j=k / ijk=−1 defining relations, non-commutativity, identity/inverse, norm, axis-angle round-trip, quaternion↔matrix round-trip across 6 cases incl. near-180°, Euler round-trip in non-gimbal region, gimbal-lock detection at ±90° pitch, slerp endpoints/midpoint/monotonicity/short-path, composition order, double-cover equivalence of q and −q, length-preserving isometry, presets, world defaults). Multi-language support (zh, en, es, fr, de, ru, pt).

## Related content

- [Zero-Order Reaction - Interactive Visualization](https://elysiatools.com/en/visualizations/zero-order-reaction): Interactive visualization of zero-order reaction kinetics and concentration changes over time
- [First-Order Reaction - Interactive Visualization](https://elysiatools.com/en/visualizations/first-order-reaction): Interactive visualization of first-order reaction kinetics and exponential concentration decay
- [Second-Order Reaction - Interactive Visualization](https://elysiatools.com/en/visualizations/second-order-reaction): Interactive visualization of second-order reaction kinetics and bimolecular collision dynamics
- [Arrhenius Equation](https://elysiatools.com/en/visualizations/arrhenius-equation): Interactive visualization of temperature effect on reaction rate - Explore activation energy, pre-exponential factor, and rate constant relationship
- [Reversible Reaction](https://elysiatools.com/en/visualizations/reversible-reaction): Interactive visualization of A ⇌ B reversible reaction kinetics - Explore forward and reverse reaction rates, equilibrium constant, and concentration changes over time
- [Consecutive Reaction](https://elysiatools.com/en/visualizations/consecutive-reaction): Interactive visualization of A → B → C consecutive reaction kinetics - Explore intermediate concentration peaks, rate-determining steps, and complete evolution of all species
- [Chain Reaction](https://elysiatools.com/en/visualizations/chain-reaction): Interactive visualization of free radical chain reaction polymerization - Explore initiation, propagation, termination steps, chain growth animation, and molecular weight distribution
- [Le Chatelier's Principle](https://elysiatools.com/en/visualizations/le-chateliers-principle): Interactive visualization of Le Chatelier's Principle - Explore how changes in concentration, pressure, and temperature affect chemical equilibrium with animated molecular dynamics
