TL;DR

  1. A rotation is a linear transformation that preserves angles and distances and does not mirror. 3D rotations don’t commute.
  2. Rotation matrix: 9 numbers for 3 degrees of freedom, constrained to . Columns = axes of one frame in the other frame.
  3. Euler angles: 3 successive rotations about principal axes. Only 3 parameters, but many conventions and gimbal lock (one degree of freedom is lost).
  4. Quaternions generalize complex numbers: no singularities, easy concatenation, ideal for interpolation (SLERP). Price: 4 numbers and the constraint .
  5. Axis-angle and the exponential map: , in closed form with the Rodrigues formula. Twists add translation.
  6. Kinematic chains (e.g. a human skeleton) are modeled with the product of exponentials. No representation is best for everything.

The lecture is about how to parameterize motion, especially of humans: 3D rotation representations and kinematic chains. It goes through four parameterizations:

flowchart LR
  A["Rotation matrix<br/>9 numbers + constraints"] -- "fewer numbers" --> B["Euler angles<br/>3 numbers, gimbal lock"]
  B -- "no singularities" --> C["Quaternions<br/>4 numbers, ||q|| = 1"]
  C -- "3 numbers,<br/>good for optimization" --> D["Axis-angle / twists<br/>exponential map"]

Informally, What Is a Rotation?

Slides 2-6

It is useful to characterize a transformation by its invariances.

Rotation

A rotation is a linear transformation which preserves angles and distances, and does not mirror the object.

Commutativity of rotations

Slides 4-5

An important property of a transformation is whether it commutes.

  • 2D: yes. All rotations share the same axis (out of the plane), so the angles simply add.
  • 3D: no. Try it at home with a bottle: rotate 90° around Y, then Z, then X. Then rotate 90° around Z, then Y, then X. The results are different.

Trap

Bad things can happen if we are not careful about the order in which we apply rotations.

Bottle experiment for commutativity of 3D rotations
Slide 5: 3D rotations do not commute.

Representing rotations in 2D

Slide 6

How do we get a rotation matrix in 2D? Suppose gives the point on the unit circle for an angle .

  • rotated by :
  • rotated by :
  • A vector becomes (the rotation is linear).

So the matrix must be:

Deriving the 2D rotation matrix from rotated basis vectors
Slide 6: the columns are the rotated basis vectors.

Rotation Matrices

Slides 7-9

The most basic representation of a rotation: the 9 numbers of a matrix. Since a rotation is a linear mapping, a matrix fully characterizes it.

Take a point in body coordinates . In spatial coordinates it is

where is the axis of the body frame written in spatial coordinates.

Columns of a rotation matrix

The columns of a rotation matrix are the principal axes of one frame expressed relative to another. (Same rule as for in the world-to-camera transformation.)

Spatial frame S and body frame B, p_s = R_sb p_b
Slide 7: body frame B and spatial frame S.

Two views of rotations

Slide 8

Rotations are a common source of confusion because, unlike a translation, they can be interpreted in two ways. The math is exactly the same, but the interpretation is very different:

Coordinate transformationRelative motion in time
What moves?nothingthe object
Ideathe object is static in body coordinates; the rotation just writes it in spatial coordinatesbody and spatial frames are first aligned; the rotation moves the object from to
Framestwo frames, one pointalways spatial coordinates
Rotation as coordinate transformation vs relative motion in time
Slide 8: two views of rotations.

Tip

Don’t be misled by the identical math: a different interpretation can lead to completely new results.

Rotation matrix drawbacks

Slide 9

A rotation has only 3 degrees of freedom, but a matrix needs 9 numbers. So we need 6 additional constraints to ensure that the matrix is orthonormal, and to prevent mirroring:

Special orthogonal group

  • This makes rotation matrices suboptimal for numerical optimization, e.g. when searching for the rotation that aligns two shapes.
  • A good thing: the entries are functions of sines and cosines, so the values are bounded. This is good for machine learning tasks.

Trap

9 parameters, but only 3 degrees of freedom. The 6 constraints are 3 unit-length columns + 3 orthogonality conditions.

Euler Angles

Slides 10-17

One of the most popular parameterizations. A rotation is encoded as three successive rotations about the principal axes:

  • only 3 parameters to encode a rotation
  • derivatives are easy to compute
  • very intuitive, and easy to accumulate motion

Rotating about the fixed axes of the spatial frame, the three rotations are combined as

Euler angles

with the rotations about the three axes

Signs

Slide 12 writes the matrices with the signs of swapped (the transposed matrices, i.e. the other of the two views above). Slides 15-16 use the form shown here. Always check which convention a source uses.

Euler angles: confusion

Slides 13-14

Careful: Euler angles are a typical source of confusion!

When using Euler angles, 2 things have to be specified:

  1. Convention: the order of the axes, X-Y-Z, Z-Y-X, Z-Y-Z, …
  2. Rotations about the static spatial frame or the moving body frame:
    • extrinsic: rotate the object about the fixed coordinate axes
    • intrinsic: rotate about the axes of the object itself
Slide 14: example of intrinsic rotations (z, x', z''). Source: Wikipedia, Euler angles.

Gimbal lock

Slides 15-17

With Euler angles we can reach a configuration where there is no way to rotate around one of the three axes. The product of the three rotation matrices is

Now consider the special case , so and :

We are left with a planar rotation. It depends only on and , not on .

What happens geometrically

With the addition theorems, the entries are and . So only the sum matters: changing has exactly the same effect as changing . When two of the axes align, one degree of freedom is lost.

Gimbal with two aligned rings
Slide 17: gimbal lock, two rings of the gimbal are aligned.

Euler angles: drawbacks

  • Gimbal lock: when two of the axes align, one degree of freedom is lost.
  • The parameterization is not unique.
  • Lots of conventions.

Trap

Gimbal lock loses one degree of freedom, not all of them.

Quaternions

Slides 18-31

Gimbal lock is a real problem. Is there a parameterization that does not suffer from gimbal lock and is more compact than the 9 numbers of a rotation matrix? Yes: quaternions. To understand them, we start with where they come from: complex numbers.

Complex numbers as rotations

Slides 19-25

Why complex analysis? It is a natural way to encode geometric transformations in 2D, it simplifies code, notation, debugging and thinking, and it reduces computational cost and storage a bit.

Imaginary unit, geometrically: forget "" for now. Think of as a quarter-turn in the counter-clockwise direction. Two quarter turns map to , so (and ).

Imaginary unit as a quarter turn
Slide 20: the imaginary unit is just a quarter-turn.

Complex numbers are just 2D vectors: instead of the basis vectors we write and . Everything else behaves like a 2D vector space (vector addition, scalar multiplication), except that we get a new product between two vectors.

Complex multiplication

Angles add, magnitudes multiply. In polar form with and :

(Careful if becomes larger than .)

In rectangular form, with and :

Here are “two quarter turns, same as ”.

Euler's formula

takes an angle and returns a point on the unit circle. With and , the product is : as with real exponentiation, the exponents add.

2D rotations, matrices vs. complex numbers: rotate a vector by , then by .

MatricesComplex numbers
, , ,
needs multiplying out and “some trigonometry” to reach

Intuition

Complex numbers give us an extra product on vectors, and we can use it to compose rotations much more easily.

Quaternions generalize complex numbers

Slides 26-29

TL;DR: kind of like complex numbers, but for 3D rotations. The weird thing: 3D rotations can’t be done this way with only 3 components. Hamilton spent years looking for a generalization of complex numbers to higher dimensions. Working with four dimensions instead of three, he found quaternion algebra. On 16 October 1843, walking along the Royal Canal in Dublin, the equation came to him, and he carved it into the Broom Bridge.

Quaternion

A quaternion has 4 components:

with the additional properties

Unit length quaternions can be used to carry out rotations. The set they form is the 3-sphere .

A quaternion can also be seen as a scalar plus a 3-vector, . For a rotation by angle about the unit axis :

Quaternion from axis and angle

Much easier to remember (and manipulate) than the corresponding rotation matrix.

Quaternion as scalar plus vector, rotation axis omega and angle theta
Slide 28: a quaternion as scalar + 3-vector.

Rotations can be carried out directly in parameter space with the quaternion product:

Quaternion product and rotation

Concatenation of rotations:

Rotating a vector (written as a quaternion with zero scalar part):

is the quaternion conjugate.

Quaternions are ideal for interpolation

Slide 30

Interpolating Euler angles can give strange-looking paths, non-uniform rotation speed, and so on. Quaternions have a simple solution, SLERP (spherical linear interpolation):

SLERP

It interpolates along the arc on the unit sphere.

SLERP interpolation of airplane orientations along an arc
Slide 30: SLERP interpolates along an arc of the sphere.

Quaternions: pros and cons (Slide 31)

Pro:

  • Quaternions have no singularities.
  • Derivatives exist and are linearly independent.
  • The quaternion product allows to perform rotations.
  • Good for interpolation.

Con:

  • All this comes at the expense of using 4 numbers instead of 3.
  • We have to enforce the quadratic constraint .

Is there a representation that needs just 3 numbers and does not suffer from gimbal lock?

Axis-Angle and the Exponential Map

Slides 32-41

Axis-angle

Any rotation about the origin can be expressed by the axis of rotation () and the angle of rotation , with the exponential map:

Example: the motion of a knee joint is a rotation about an axis perpendicular to the leg and parallel to the hips.

Lie groups and Lie algebras

Slide 34

Lie group

A group is an -dimensional Lie group if the set of its elements can be represented as a continuously differentiable manifold of dimension , on which the group product and inverse are continuously differentiable functions as well.

The rotations form a Lie group . Its tangent space at the identity is the Lie algebra (). The exponential map goes from the Lie algebra to the Lie group, the derivative goes back.

Lie group and Lie algebra connected by the exponential map
Slide 34: Lie group ↔ Lie algebra.

Skew-symmetric matrix

Slide 35

Hat operator

For a vector , the skew-symmetric matrix is

It is the matrix form of the cross product: . You will also find it written as or .

Exponential map

Slides 36-41

The exponential map recovers the rotation matrix from the axis-angle representation (the Lie algebra):

Point rotating about an axis, derivation of the exponential map
Slide 40: a point rotating about the axis ω.

The matrix exponential is an infinite series:

Exploiting the properties of skew-symmetric matrices (for a unit axis, ), the series collapses to the sine and cosine series:

Rodrigues formula

Closed form! No infinite series needed.

Twists

Slides 42-43

What about translation? Twists extend axis-angle to rigid body motion (rotation + translation).

Twist

The twist coordinates are

and the twist is the matrix

Twist: a point moving along a screw around the axis omega
Slide 42: a twist moves a point along a screw.

The rigid body motion can also be computed in closed form:

Exponential of a twist

Which Representation Should I Use?

Slide 44

There is no representation that is best for everything. The slide ranks them per criterion (top row = best):

RankNumber of parametersSingularitiesHuman constraintsConcatenate motionOptimization (derivatives)
1TwistsQuaternionsTwistsQuaternionsTwists
2Euler anglesTwistsQuaternionsTwistsEuler angles
3QuaternionsEuler anglesEuler anglesEuler anglesQuaternions
Table: which representation should I use
Slide 44: the original table.

Exam relevance

This table is typical multiple-choice material. Know for each criterion which representation wins:

  • few parameters, human constraints and optimization with derivatives → twists
  • no singularities and concatenating motion → quaternions
  • quaternions need 4 numbers, not 3
  • rotation matrices: bounded values, good as network output, but 9 numbers with constraints

Articulation: Kinematic Chains

Slides 45-51

A human body is an articulated object: segments connected by joints. Each joint is described by a twist (its axis) and an angle .

Rest position: a point on the last segment, given in body coordinates , is in the spatial frame

After rotating the joints by and , the coordinates of the point in the spatial frame are

Two-segment kinematic chain with joint twists xi_1 and xi_2
Slide 48: a two-joint kinematic chain.

Product of exponentials

is the mapping from coordinates to coordinates .

Trap

is not the mapping from segment to segment . Think of it simply as the relative motion of that joint.

Inverse kinematics

Slides 50-51

Suppose we want to find the joint angles so that a point on the body reaches a specific goal :

The problem is non-linear. We linearize it with the articulated Jacobian.

Stick figure reaching a goal point by changing joint angles
Slide 50: inverse kinematics.

Further reading (Slide 52): Keenan Crane’s computer graphics slides on quaternions (CMU); Pons-Moll & Rosenhahn, ICCV 2011 tutorial and book chapter on model-based human pose estimation; A Mathematical Introduction to Robotic Manipulation (a rigorous treatment of twists and exponential maps for articulated bodies).

Summary

RepresentationNumbersProsCons
Rotation matrix9linear, bounded values (good for ML)6 constraints + , bad for optimization
Euler angles3intuitive, easy derivativesgimbal lock, not unique, many conventions
Quaternion4no singularities, easy concatenation, SLERP4 numbers, constraint
Axis-angle / twist3 (6 with translation)few parameters, good for optimization and human constraints, closed form via Rodriguesranked below quaternions for singularities and for concatenating motion

Exam relevance

Rotations were not a main exam task, but they are multiple-choice material:

  • 3D rotations don’t commute.
  • Rotation matrix: 9 numbers, 3 degrees of freedom, .
  • Euler angles: specify the order and intrinsic vs. extrinsic; gimbal lock loses one degree of freedom.
  • Quaternions: no singularities, 4 numbers, good for interpolation.
  • The table “Which representation should I use?”.

Self-Test

Do 3D rotations commute? And 2D rotations?

What do the columns of contain?

A rotation matrix has 9 entries. How many degrees of freedom, and which constraints?

What two things must be specified when using Euler angles?

What is gimbal lock, and how do you see it in the matrix?

How do you rotate a vector with a quaternion, and how do you build a quaternion from axis and angle?

What are the advantages and the price of quaternions?

What does the exponential map do, and what is its closed form?

What is ?

Which representation for optimization, for interpolation, for concatenating motions?

What does mean in the product of exponentials?