Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Turning in three dimensions

The question. How do we write down which way a bone is facing, and how it is turning?

On a flat page one angle is enough. A real upper arm can be raised forward, raised sideways and twisted about its own length, and these three do not behave like three separate angles on three flat pages. A simulator that gets this wrong produces arms that flip or freeze in certain poses. This chapter gives three ways to store an orientation, shows where the most obvious one fails, and describes turning as a vector.

By the end you will be able to turn a vector about any axis, combine two turns in the right order, and say why the simulator stores orientations as four numbers.

The room’s axes

Throughout the book the fixed axes are forward, up and toward the body’s right, and the arm is the right arm. This is the convention recommended for reporting arm motion (Wu et al. 2005).

Orientation as a matrix

Fix three perpendicular unit arrows to a bone, its own , and axes. Together they are the bone’s frame. The bone’s orientation is where those three arrows now point in the room.

Write each arrow as a column of three numbers and set the columns side by side. The result is a rotation matrix . A point that sits at along the bone’s own axes is, in the room, times the first column plus times the second plus times the third, which is the matrix product . So converts the bone’s coordinates into the room’s.

The columns have unit length and are perpendicular to each other. That is six conditions on nine numbers, which leaves three numbers’ worth of freedom.

Turning about an axis

Turn a bone by an angle about the axis. Its arrow moves to , its arrow to , and its arrow stays. Those are the columns:

A positive angle turns anticlockwise when the axis points toward you.

For a turn about any unit axis , split a vector into the part along the axis, which stays, and the part across it, which swings round in its own plane:

With along and along this gives , the first column above.

The order of turns matters

Let the arm hang straight down, with the palm 0.622 m below the shoulder, at . Consider two turns about axes fixed in the room:

  • A: 90° about the side-to-side axis , which raises the arm forward.
  • B: 90° about the front-to-back axis, pointing backward, , which raises the arm out to the side.

A then B. takes the palm to , straight ahead. That point lies on B’s axis, so leaves it there. The arm ends pointing forward, twisted a quarter turn about its own length.

B then A. takes the palm to , out to the right. That point lies on A’s axis, so leaves it there. The arm ends pointing sideways.

The same two turns give hands 0.88 m apart. When turns are about room-fixed axes, each later turn multiplies on the left: A then B is , and . The shoulder shows this so strongly that the international recommendation for describing it avoids the everyday names of these two movements, because one followed by the other “would give radically different results” from the reverse order (Wu et al. 2005, section 2.4.4).

Three angles, and their bad spot

Since an orientation has three numbers’ worth of freedom, three angles can describe it. For the upper arm we use:

  1. raise forward by about the room’s axis;
  2. raise sideways by about the bone’s own front-to-back axis, wherever the first turn has carried it;
  3. twist by about the bone’s own long axis, wherever the first two have carried it.

Each turn is about an axis carried by the bone, and in that case the matrices multiply in the order the turns are made: .

Now set , the arm straight out to the side. Its long axis lies along the room’s axis. Turn 1 and turn 3 are then about the same line. Changing and changing do the same thing to the arm, and there is a direction of turning, about the forward axis, that no change of the three angles can produce. This is gimbal lock: the first and third axes of a three-angle description line up, and one direction of turning is lost (Diebel 2006, section 5.8).

A measure of how close the lock is: the volume of the box spanned by the three unit axes. Here it equals . It is 1 when the axes are perpendicular and 0 at the lock.

Every choice of three angles has such a spot. The sequence recommended for reporting shoulder motion turns about the vertical axis, then about an axis across the arm, then about the arm’s long axis (Wu et al. 2005, section 2.4.7); its first and third axes coincide when the arm hangs straight down.

Four numbers instead: the unit quaternion

Any orientation can be reached from the starting one by a single turn through some angle about some unit axis . A unit quaternion stores that turn as four numbers (Diebel 2006, section 6.12):

The squares of the four numbers always add to 1.

To rotate a vector: .

To combine two turns, first and then , both about room-fixed axes (Diebel 2006, section 6.2):

The cross product in the last term is what makes the order matter.

Four numbers with one condition again leave three freedoms, but no pose is special. Every orientation has a quaternion, and a small turn always changes the four numbers a little. The simulator stores the orientation of any freely turning body this way (crates/biomech/src/rotation.rs) and builds the matrix from it when needed.

Turning as a vector

At any instant a turning body is turning about one line. Its angular velocity is a vector along that line whose length is the rate of turning in radians per second. The direction follows the same rule as for angles: seen with the arrow pointing at you, the body turns anticlockwise.

A point of the body at position from any point on the axis moves with velocity . A forearm turning at 2 rad/s about the elbow’s axis carries a palm at from the elbow at m/s: upward.

Angular velocities add as vectors. For the three shoulder angles, with unit axes in their current directions,

where a dot over a symbol means its rate of change. At gimbal lock and lie on one line, so the three terms can only build vectors in a plane.

A worked example

The quarter turns as quaternions. A is 90° about : . B is 90° about : . Rotating by A: , so and . The sum is , matching the first column of .

A then B: and . Since , the two quarter turns together equal one turn of 120° about the diagonal .

Near the lock. With and the axes are and . The lines they lie on are 30° apart, and the volume is . If and both rise at 30°/s, which is 0.5236 rad/s, then , a turning rate of 0.271 rad/s.

Try it

  1. Check the worked example. With both turns at 90° the solid arm (A then B) points forward and the pale arm (B then A) points to the side. The hands are 0.879 m apart, and each sequence equals one turn of 120°. Press Play to watch the turns happen.
  2. Predict, then check. Set turn B to 0°. Will the two arms differ? They coincide: with one turn there is no order.
  3. Make the turns small. Set both to 10°. The hands are 2 mm apart and the poses differ by 1.7°. For small turns the order hardly matters, which is why a flat-page intuition works for small movements.
  4. Find a pose where order still does not matter. Try both turns at 180°.

  1. Check the worked example. With angle 2 at 60°, axes 1 and 3 are 30° apart, the volume is 0.5, and the turning rate reads 15.5°/s, which is 0.271 rad/s. Press Play: the arm turns.
  2. Go to the lock. Set angle 2 to 90°. Axis 3 lies along axis 1, the volume is 0 and only two directions of turning are left. Press Play. Angles 1 and 3 both keep rising, and the arm does not move at all.
  3. Watch the quaternion. In that locked run the four quaternion numbers stay fixed, because the orientation is not changing. They have no trouble naming it.
  4. Predict, then check. At angle 2 = 85°, how fast will the arm turn when you press Play? About 2.6°/s: nearly locked.
  5. Feel the lost direction. At 90°, move slider 1 and then slider 3. Both only spin the arm about its own length.

What this model leaves out

  • How torque changes angular velocity in three dimensions. For a single fixed axis it is . The general case, for chains of bones, is in The equations of a moving chain.
  • Which turns a real joint allows. A shoulder cannot reach every orientation. Joints and degrees of freedom counts the freedoms; Part 5 adds the tissues that limit them.

Summary

  • An orientation is a rotation matrix whose columns are the bone’s axes.
  • The order of two turns changes the result, except when the turns are small.
  • Three angles can describe an orientation but lose a direction of turning where their first and third axes line up.
  • A unit quaternion, , stores an orientation in four numbers with no such spot.
  • Angular velocity is a vector along the instantaneous axis, and angular velocities add.

Next: real bones cannot turn every way; joints decide which ways they can.