Skip to main content

Quaternions

  • Situation: Stable rotation composition and interpolation
  • Target: Convention · Vector rotation · Composition
  • Convention: Right-handed orthonormal frame; column vectors; rightmost matrix first; angles in radians unless marked °; lengths in m · Overview

Core concepts​

  • Convention: Hamilton quaternion q=(w,x,y,z), scalar first; unit q for rotation; q=(cos(θ/2), n sin(θ/2))

  • Vector rotation: pure quaternion p=(0,v), p′=qpq⁻¹; conjugate q*=(w,−x,−y,−z), inverse q*/‖q‖²

  • Composition: q2q1 applies q1 first, matching R2R1; normalization after accumulated numeric drift, zero quaternion rejected

  • Double cover: q and −q as the same orientation; sign correction q1→−q1 when dot(q0,q1) negative before interpolation

  • SLERP: unit endpoints and sign-corrected shortest arc; clamp dot to valid acos range; near-zero arc → normalized linear interpolation

Worked example​

90° around +z: q=(√2/2,0,0,√2/2), d=(3,4,0) → (−4,3,0); halfway from identity: (cos(π/8),0,0,sin(π/8)), physical angle 45°

(a,u)(b,v)=(ab−u⋅v, av+bu+u×v)(a,\mathbf u)(b,\mathbf v)=(ab-\mathbf u\cdot\mathbf v,\ a\mathbf v+b\mathbf u+\mathbf u\times\mathbf v) Ω=arccos⁡(q0⋅q1),slerp⁡(q0,q1,t)=sin⁡((1−t)Ω)sin⁡Ωq0+sin⁡(tΩ)sin⁡Ωq1,0≤t≤1\Omega=\arccos(q_0\cdot q_1),\quad \operatorname{slerp}(q_0,q_1,t)=\frac{\sin((1-t)\Omega)}{\sin\Omega}q_0+\frac{\sin(t\Omega)}{\sin\Omega}q_1,\quad 0\le t\le1
Stable rotation composition and interpolation
Figure 1. Stable rotation composition and interpolation

Practice​

  • Preparation → prediction → calculation: Prior axis–angle and matrix; predict vector output → compute qpq⁻¹ → compare three representations → test q/−q interpolation with sign correction; retained convention and numerical checks
  • Record: Assumed exercise inputs; predictions before calculation; calculated answers and optional viewer output in separate columns; no physical measurements
CasePredictionCalculated resultViewer output (optional)
q−1,q=(2/2,0,0,2/2)q^{-1},\quad q=(\sqrt2/2,0,0,\sqrt2/2)
q2q^2
12(q+(−q))\tfrac12(q+(-q))
  • Optional extension: Exactly 180° relative rotation: multiple shortest paths; explicit axis or continuity policy

Exercises​

  1. Problem: q−1,q=(2/2,0,0,2/2)q^{-1},\quad q=(\sqrt2/2,0,0,\sqrt2/2)
  2. Problem: q2q^2
  3. Problem: 12(q+(−q))\tfrac12(q+(-q))
  4. Problem: Correction before interpolating q and −q
Answers and checks
  1. Answer: (2/2,0,0,−2/2)(\sqrt2/2,0,0,-\sqrt2/2)
  2. Answer: (0,0,0,1)(0,0,0,1)
  3. Answer: (0,0,0,0)(0,0,0,0)
  4. Answer: Flip one endpoint sign; constant orientation and unit norm

Connections​