Quaternions· Visually
Home / Part B / 7

Chaining turns: the object's axes or the world's axes

Lesson 7 · Interactive

When we add one more turn to the object, there are two different questions: turn about the object's own axis, or about the fixed world axis? The answer decides which side we multiply on.

7.1Two kinds of "turn about x"

Imagine the object already turned 90° about z. Now "turn about x". The object’s own x has moved with it, but the world’s x is still where it was. These are two different turns, and they give different results.

Visual 1 of 3 · The object's x or the world's X
Try it: the object has already turned 90° about z. Press the first button, go back to the start, then press the second. Same angle, same letter x, two different results.

Here q is the orientation so far, and Δq (delta q) is the quaternion of the new turn. The arrow ← means: replace q by what stands on the right.

\[\text{about the object’s axes:}\ \ q \leftarrow q \otimes \Delta q \qquad\qquad \text{about the world axes:}\ \ q \leftarrow \Delta q \otimes q\]

With numbers. Start with q = 90° about z = [0.707, 0, 0, 0.707], and add Δq = 90° about x = [0.707, 0.707, 0, 0]:

\[q \otimes \Delta q = [0.5,\ 0.5,\ 0.5,\ 0.5] \qquad\qquad \Delta q \otimes q = [0.5,\ 0.5,\ -0.5,\ 0.5]\]

Two different results, so two different orientations.

Why this way round? From lesson 5, the quaternion on the right acts first. In \(\Delta q \otimes q\), the old q acts first and the new turn comes after it, about the world axes. In \(q \otimes \Delta q\), the new turn acts first, while the object is still in its start pose, where its own axes and the world axes are the same. Then q carries the whole thing along. So the new turn ends up about the object’s own axes.

Visual 2 of 3 · Chain as many turns as you like
Try it: press +90° about z, then +90° about x, with "the object's axes". Remember the pose. Press Reset, switch to "the world axes" and do the same two steps. The object ends up in a different place. Watch the faint X, Y, Z world axes: they never move.

7.2Euler angles are a chain of three turns

Now we can write the ZYX Euler angles as one product:

\[q = q_{yaw} \otimes q_{pitch} \otimes q_{roll}\]

Read it left to right: yaw, then pitch about the new y, then roll about the newest x. Those are turns about the object’s own axes, multiplied on the right. Read it right to left: roll, pitch, yaw about the fixed world axes. Both readings give the same result. That’s why both descriptions of Euler angles you see in books are correct.

Visual 3 of 3 · Euler angles are three turns in a chain
Try it: press play. First yaw about z, then pitch about the y axis the object has now, then roll about the x axis it has now. The dashed line is the axis of the current step.

7.3Which one do I need?

Ask where the turn is measured. A gyroscope is fixed to the object, and a pilot or a player thinks "pitch up" from the cockpit. Those are turns about the object’s own axes, so we multiply on the right: \(q \leftarrow q \otimes \Delta q\). A user dragging a 3D model on the screen turns it about the fixed screen axes, so we multiply on the left. We use the first one in lesson 9.

One more thing

Every multiplication adds a tiny rounding error, and after thousands of steps the length of q drifts away from 1. So after chaining, we divide q by its length. One square root and four divisions, and q is a clean rotation again.

Remember
  • Object axes (many books say body axes): multiply the new turn on the right, q ⊗ Δq.
  • World axes: multiply on the left, Δq ⊗ q.
  • Turn rates measured on the object itself are object-axis turns.
  • Normalise q after many multiplications.

✓Check yourself

A player pushes the stick to pitch the plane. Do we multiply the new turn on the left or on the right?

On the right, q ⊗ Δq. The player thinks from inside the plane, so it is a turn about the object’s own axes.

Is "yaw 90° then roll 90° about the object's axes" the same as "roll 90° then yaw 90° about the world axes"?

Yes. Both are q_yaw ⊗ q_roll. Try it in the lab.

+Sources and further reading

Next: From quaternion to rotation matrix and Euler angles, and back.