TL;DR
- A rotation is a linear transformation that preserves angles and distances and does not mirror. 3D rotations don’t commute.
- Rotation matrix: 9 numbers for 3 degrees of freedom, constrained to . Columns = axes of one frame in the other frame.
- Euler angles: 3 successive rotations about principal axes. Only 3 parameters, but many conventions and gimbal lock (one degree of freedom is lost).
- Quaternions generalize complex numbers: no singularities, easy concatenation, ideal for interpolation (SLERP). Price: 4 numbers and the constraint .
- Axis-angle and the exponential map: , in closed form with the Rodrigues formula. Twists add translation.
- 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.
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:
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.)
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 transformation | Relative motion in time | |
|---|---|---|
| What moves? | nothing | the object |
| Idea | the object is static in body coordinates; the rotation just writes it in spatial coordinates | body and spatial frames are first aligned; the rotation moves the object from to |
| Frames | two frames, one point | always spatial coordinates |
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:
- Convention: the order of the axes, X-Y-Z, Z-Y-X, Z-Y-Z, …
- 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
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.
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 ).
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 .
| Matrices | Complex 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.
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.
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.
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):
Proof: exponential map (Slides 37-40)
Consider a point rotating about the axis with unit angular velocity, following a trajectory in time. Its velocity is perpendicular to the axis and to the point:
This is a linear differential equation. Its solution is
If we rotate for units of time, we get the rotation
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
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):
| Rank | Number of parameters | Singularities | Human constraints | Concatenate motion | Optimization (derivatives) |
|---|---|---|---|---|---|
| 1 | Twists | Quaternions | Twists | Quaternions | Twists |
| 2 | Euler angles | Twists | Quaternions | Twists | Euler angles |
| 3 | Quaternions | Euler angles | Euler angles | Euler angles | Quaternions |
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
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.
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
| Representation | Numbers | Pros | Cons |
|---|---|---|---|
| Rotation matrix | 9 | linear, bounded values (good for ML) | 6 constraints + , bad for optimization |
| Euler angles | 3 | intuitive, easy derivatives | gimbal lock, not unique, many conventions |
| Quaternion | 4 | no singularities, easy concatenation, SLERP | 4 numbers, constraint |
| Axis-angle / twist | 3 (6 with translation) | few parameters, good for optimization and human constraints, closed form via Rodrigues | ranked 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?
Answer
3D rotations don’t commute: each has its own axis, so the first changes the pose relative to the second axis. 2D rotations commute because they all share the same axis, the angles just add.
What do the columns of contain?
Answer expressed in spatial coordinates: .
The principal axes of the body frame
A rotation matrix has 9 entries. How many degrees of freedom, and which constraints?
Answer against mirroring: .
3 degrees of freedom. 6 constraints for orthonormality (3 unit-length columns, 3 orthogonality conditions) plus
What two things must be specified when using Euler angles?
Answer
The convention (axis order, e.g. X-Y-Z or Z-Y-Z) and whether the rotations are about the fixed spatial axes (extrinsic) or the moving body axes (intrinsic).
What is gimbal lock, and how do you see it in the matrix?
Answer , two axes align and one degree of freedom is lost. The product then depends only on : a planar rotation is left.
For
How do you rotate a vector with a quaternion, and how do you build a quaternion from axis and angle?
Answer with the conjugate . From axis and angle : , .
What are the advantages and the price of quaternions?
Answer .
No singularities, linearly independent derivatives, rotations via the quaternion product, good interpolation (SLERP). Price: 4 numbers instead of 3 and the constraint
What does the exponential map do, and what is its closed form?
Answer . Closed form (Rodrigues): .
It maps the axis-angle representation (Lie algebra) to a rotation matrix:
What is ?
Answer , the matrix form of the cross product: .
The skew-symmetric matrix of
Which representation for optimization, for interpolation, for concatenating motions?
Answer
Optimization (derivatives) and few parameters: twists. Interpolation, concatenation and no singularities: quaternions.
What does mean in the product of exponentials?
Answer . It is not the mapping from segment to segment .
The relative motion of joint
Related
- Previous: Lecture 2.1: Image Formation · Next: Lecture 3: Classical Reconstruction · Course: Overview
- Concepts: Rotation Matrix, Euler Angles, Quaternion, Axis-Angle and Exponential Map, Twist, Extrinsic Parameters
- Rotations come back later: in Procrustes alignment (Lecture 5) and in the covariance of 3D Gaussians, which is built from a quaternion (Lecture 8).