3.5.8 · D3Guidance, Navigation & Control (GNC)

Worked examples — Quaternion rotation formula — rotating vector v by quaternion q

3,345 words15 min readBack to topic

This page is the drill hall for the quaternion rotation formula. The parent note derived . Here we throw every kind of input at it — every axis, every sign of angle, the fixed vector, the zero vector, the zero rotation, the full turn, composition, and a real spacecraft problem — so you never meet a case you haven't seen worked.

Everything rests on one recipe, so let us restate it in plain words before any symbol appears again.

Recall The recipe in one breath

A quaternion is four numbers: a scalar and a vector , written . To turn (rotate) a 3D arrow by angle about a spin-axis (a unit-length arrow saying "spin around ME"):

  1. Build — the half-angle lives inside.
  2. Wrap the arrow as a pure quaternion (zero scalar).
  3. Sandwich: , where for a unit . The output ; read off .

We will mostly shortcut the algebra using the equivalent Rodrigues' rotation formula the parent proved, but Example 1 does the full Hamilton-product sandwich by hand once so you trust it.


The scenario matrix

Every problem this topic throws is one of these cells. Read the table as a checklist of inputs you must be able to survive — each row is a different kind of thing the formula can be fed, and the "Trap" column names the mistake that cell tends to trigger. The worked examples then walk each row so no cell is left as words-only.

# Case class The trap this cell hides Example
A Axis-aligned, positive angle forgetting the half-angle in Ex 1, Ex 2
B Vector on the axis (degenerate) expecting it to move Ex 3
C Negative / reversed angle wrong spin direction Ex 4
D Identity / zero rotation () dividing by to get an axis Ex 5
E Full turn , double cover thinking means "flipped" Ex 5
F Tilted axis, general vector non-unit axis silently rescales Ex 6
G Composition (order matters) writing instead of Ex 7
H Real-world word problem (GNC) mixing body vs inertial frame Ex 8
I Recover axis+angle from a given reading axis off an un-normalised Ex 9
J Zero vector input expecting a division-by-length error Ex 10

Example 1 — Cell A: the full sandwich, by hand

Figure — Quaternion rotation formula — rotating vector v by quaternion q

Example 2 — Cell A: axis-aligned, arbitrary angle


Example 3 — Cell B: vector on the axis is frozen


Example 4 — Cell C: negative angle reverses the spin


Example 5 — Cells D & E: identity, full turn, and the double cover


Example 6 — Cell F: a tilted axis and a general vector


Example 7 — Cell G: composition — order matters


Example 8 — Cell H: real-world GNC word problem


Example 9 — Cell I: exam twist — recover axis and angle from a given


Example 10 — Cell J: the zero vector — a degenerate input


Recall Quick self-test

A turn about sends to? ::: A vector along the rotation axis becomes? ::: itself (unchanged) and rotate a vector? ::: identically (double cover) To compose "rotate by then ", the single quaternion is? ::: Given , the rotation angle is? ::: Rotating the zero vector by any gives? ::: the zero vector