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°
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
| Case | Prediction | Calculated result | Viewer output (optional) |
|---|---|---|---|
- Optional extension: Exactly 180° relative rotation: multiple shortest paths; explicit axis or continuity policy
Exercises
- Problem:
- Problem:
- Problem:
- Problem: Correction before interpolating q and −q
Answers and checks
- Answer:
- Answer:
- Answer:
- Answer: Flip one endpoint sign; constant orientation and unit norm
Connections
- Previous: Axis-Angle
- Overview: 3D Math