Search

Search papers and lessons

Rigid Body Transformation

Level 3 · 13 min read

A rigid body transformation moves a shape without bending or stretching it, using one rotation and one translation, and packs both into a single 4 by 4 matrix.

On this page

  • Colour = topic mix
  • Linear algebra
  • Discrete math
  • Kinematics and dynamics
  • Sign in to see your progress

TL;DR

A rigid body transformation moves a point, or a whole object, without changing any distance inside it. It is a rotation followed by a translation: first turn the object about its origin, then shift it. Written with homogeneous coordinates, both steps fold into one 4×44 \times 4 matrix, so a chain of motions becomes a product of matrices.

Where you'll see it: in robot arms that track the pose of every link, in camera pose estimation for SLAM, and in any simulator that places a rigid object in a scene.

Intuition

Moving a block without deforming it

Pick up a book and move it across a table. Every point on the book moves, but the distances between points stay fixed. You can turn the book on the table, slide it, or both, and it is still the same book. A transformation with that property is called rigid. It does not stretch, squash, shear, or bend the object.

Robots care about this because a link of an arm is a rigid body. Its shape is known, and what changes is where it sits. The robot needs a way to say "this link is rotated this much and sits at that position" and to combine that statement with the statement for the link before it.

Two parts, one object

A rigid motion has two parts. The rotation says how the object is oriented. The translation says where the object's origin ends up. The order matters: rotating after a shift swings the object around a different center than rotating first.

flowchart LR
  W[world frame] -->|base pose| B[base frame]
  B -->|link pose| L[link frame]
  L -->|tool offset| T[tool frame]

Each arrow is a rigid transformation. Chaining the arrows gives the pose of the tool in the world, and that chain is what forward kinematics computes.

The math

Definition

A rigid body transformation in nn dimensions is a map gg of the form

g(p)=Rp+t,g(\mathbf{p}) = R\mathbf{p} + \mathbf{t},

where p\mathbf{p} is a point, RR is a rotation matrix, and t\mathbf{t} is a translation vector. The rotation RR is an orthogonal matrix with determinant +1+1, which means it is a member of the Special Orthogonal Group SO(3) SO(n)SO(n). The set of all such maps for n=3n = 3 is the special Euclidean group SE(3)SE(3).

Why it preserves distances

Take two points p\mathbf{p} and q\mathbf{q}. Applying gg to both and subtracting, the translation cancels:

g(p)−g(q)=Rp+t−Rq−t=R(p−q).g(\mathbf{p}) - g(\mathbf{q}) = R\mathbf{p} + \mathbf{t} - R\mathbf{q} - \mathbf{t} = R(\mathbf{p} - \mathbf{q}).

The length of a vector is ∥v∥=v⊤v\lVert \mathbf{v} \rVert = \sqrt{\mathbf{v}^\top \mathbf{v}}, so the length of the rotated difference is

∥R(p−q)∥2=(p−q)⊤R⊤R (p−q).\lVert R(\mathbf{p} - \mathbf{q}) \rVert^2 = (\mathbf{p} - \mathbf{q})^\top R^\top R \,(\mathbf{p} - \mathbf{q}).

Orthogonality means R⊤R=IR^\top R = I, so the right side reduces to ∥p−q∥2\lVert \mathbf{p} - \mathbf{q} \rVert^2. Every distance is preserved. Determinant +1+1 rules out reflections, which also preserve distances but turn a left hand into a right hand.

Homogeneous form

Append a 1 to each point, p~=(p,1)\tilde{\mathbf{p}} = (\mathbf{p}, 1), and pack the motion into a single matrix:

T=(Rt0⊤1),Tp~=(Rp+t1).T = \begin{pmatrix} R & \mathbf{t} \\ \mathbf{0}^\top & 1 \end{pmatrix}, \qquad T\tilde{\mathbf{p}} = \begin{pmatrix} R\mathbf{p} + \mathbf{t} \\ 1 \end{pmatrix}.

Now a composition of motions is a matrix product. If T1T_1 moves a point into frame 1 and T2T_2 moves frame 1 into frame 2, then T2T1T_2 T_1 does both in one step. Reading products right to left is the usual convention.

The inverse has a closed form, so you never need a general matrix inverse:

T−1=(R⊤−R⊤t0⊤1).T^{-1} = \begin{pmatrix} R^\top & -R^\top \mathbf{t} \\ \mathbf{0}^\top & 1 \end{pmatrix}.

How the rotation depends on the angle

For the plane, the rotation through angle θ\theta is

R(θ)=(cos⁡θ−sin⁡θsin⁡θcos⁡θ).R(\theta) = \begin{pmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{pmatrix}.

The plot shows the two entries that change with the angle. Every entry of a rotation matrix is bounded by one, and the columns always have length one.

0123456−1−0.500.51angle θ in radiansmatrix entry
  • cos θ (entries 11 and 22)
  • sin θ (entry 21)
The entries of a 2D rotation matrix as the angle goes from 0 to 2π. At θ = π/2 the rotation sends the x axis to the y axis, and the marked point is where cos θ = 0 and sin θ = 1.

Worked examples

Example
Rotate a point 90 degrees, then shift it, in the plane

Let the transformation rotate by 90∘90^\circ and translate by t=(2,1)\mathbf{t} = (2, 1). Apply it to the point p=(1,1)\mathbf{p} = (1, 1).

  1. For 90∘90^\circ, cos⁡θ=0\cos\theta = 0 and sin⁡θ=1\sin\theta = 1, so R=(0−110)R = \begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix}.
  2. Compute the rotation: Rp=(0⋅1+(−1)⋅1,  1⋅1+0⋅1)=(−1,1)R\mathbf{p} = (0 \cdot 1 + (-1) \cdot 1,\; 1 \cdot 1 + 0 \cdot 1) = (-1, 1).
  3. Add the translation: (−1,1)+(2,1)=(1,2)(-1, 1) + (2, 1) = (1, 2).
  4. Check with the homogeneous matrix. T=(0−12101001)T = \begin{pmatrix} 0 & -1 & 2 \\ 1 & 0 & 1 \\ 0 & 0 & 1 \end{pmatrix} applied to (1,1,1)(1, 1, 1) gives (0−1+2,  1+0+1,  1)=(1,2,1)(0 - 1 + 2,\; 1 + 0 + 1,\; 1) = (1, 2, 1). The two methods agree.

Interpretation: the point's offset from the object's origin was turned a quarter turn to (−1,1)(-1, 1), and then the origin itself moved to (2,1)(2, 1). The point finishes at (1,2)(1, 2).

Example
Undo the motion with the inverse, and compose two motions

Use the same TT as above, with R=(0−110)R = \begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix} and t=(2,1)\mathbf{t} = (2, 1).

  1. The inverse formula needs R⊤=(01−10)R^\top = \begin{pmatrix} 0 & 1 \\ -1 & 0 \end{pmatrix}.
  2. Compute −R⊤t=−(0⋅2+1⋅1,  −1⋅2+0⋅1)=−(1,−2)=(−1,2)-R^\top \mathbf{t} = -(0 \cdot 2 + 1 \cdot 1,\; -1 \cdot 2 + 0 \cdot 1) = -(1, -2) = (-1, 2).
  3. So T−1=(01−1−102001)T^{-1} = \begin{pmatrix} 0 & 1 & -1 \\ -1 & 0 & 2 \\ 0 & 0 & 1 \end{pmatrix}.
  4. Apply it to the moved point (1,2)(1, 2): x=0⋅1+1⋅2−1=1x = 0 \cdot 1 + 1 \cdot 2 - 1 = 1 and y=−1⋅1+0⋅2+2=1y = -1 \cdot 1 + 0 \cdot 2 + 2 = 1. That returns (1,1)(1, 1), the original point.

Now compose. Let T2T_2 be a pure shift by (0,3)(0, 3), so T2=(100013001)T_2 = \begin{pmatrix} 1 & 0 & 0 \\ 0 & 1 & 3 \\ 0 & 0 & 1 \end{pmatrix}. Multiplying gives T2T1=(0−12104001)T_2 T_1 = \begin{pmatrix} 0 & -1 & 2 \\ 1 & 0 & 4 \\ 0 & 0 & 1 \end{pmatrix}.

  1. Apply T1T_1 first: (1,1)↦(1,2)(1, 1) \mapsto (1, 2), as above.
  2. Then apply the shift: (1,2)↦(1,5)(1, 2) \mapsto (1, 5).
  3. The single product sends (1,1,1)(1, 1, 1) to (0−1+2,  1+0+4,  1)=(1,5,1)(0 - 1 + 2,\; 1 + 0 + 4,\; 1) = (1, 5, 1), the same point.

Interpretation: the product is one matrix that does both motions. Reversing the order, shifting first and then rotating, would give a different matrix and a different point, which is why the order of multiplication matters.

Example
A tool on a rotated robot base

A robot base sits at (1,0,0)(1, 0, 0) in the world and is rotated 90∘90^\circ about the zz axis, so its rotation is Rz=(0−10100001)R_z = \begin{pmatrix} 0 & -1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 1 \end{pmatrix}. A tool tip sits at (0.5,0,0.2)(0.5, 0, 0.2) in the base frame. Where is the tip in the world?

  1. Rotate the tip position: Rz(0.5,0,0.2)=(0⋅0.5−1⋅0,  1⋅0.5+0⋅0,  0.2)=(0,0.5,0.2)R_z (0.5, 0, 0.2) = (0 \cdot 0.5 - 1 \cdot 0,\; 1 \cdot 0.5 + 0 \cdot 0,\; 0.2) = (0, 0.5, 0.2).
  2. Add the base position: (0,0.5,0.2)+(1,0,0)=(1,0.5,0.2)(0, 0.5, 0.2) + (1, 0, 0) = (1, 0.5, 0.2).

Interpretation: a tip that sits half a metre ahead of the base in its own frame ends up half a metre to the side of the base in the world, because the base is turned. Forgetting the rotation here puts the tip in the wrong place, which is one of the most common bugs in arm code.

Tradeoffs and failure modes

RepresentationGood forWhat goes wrong
4×44 \times 4 homogeneous matrixChaining transforms by multiplicationUses 16 numbers for a 6 degree of freedom pose, and small errors can break orthogonality
Euler anglesHuman-readable roll, pitch and yawGimbal lock at some angles, and the order of the three rotations changes the result
Unit quaternionCompact storage and smooth interpolation between orientationsMust be renormalized after updates, and sign conventions confuse beginners
Axis-angle vectorSmall rotations and optimizationSingular at zero rotation and awkward to compose directly

Practical failure modes are also common. Repeated multiplication lets the rotation drift away from orthogonality, so periodically re-orthogonalize it. Pre-multiplying and post-multiplying give different results, so write down which frame each transform maps from and to. Using a reflection matrix with determinant −1-1 mirrors a robot without any error message. Finally, rigid motion is only an approximation when the body flexes, as with cables or soft robots, and then the rigid model is the wrong model.

History

Leonhard Euler showed in the 1700s that any rotation about a fixed point is a single rotation about some axis, which is the content behind axis-angle. Olinde Rodrigues gave the closed-form formula for that rotation in 1840, and William Rowan Hamilton introduced quaternions in 1843 to handle rotations in three dimensions. Homogeneous coordinates came from projective geometry in the 19th century, where they let points at infinity and perspective be treated the same way as ordinary points.

The chain of rigid transforms became the standard language of robotics in the mid-1950s, when Jacques Denavit and Richard Hartenberg proposed a systematic way to describe each joint of a serial arm with four parameters. Their convention, and its later variants, made it possible to compute the pose of an end effector by multiplying one matrix per joint. That product is still how forward kinematics is written in most robot software today.

Check yourself

QuestionWhat two parts does a rigid body transformation have, and which property of distances does it preserve?Show answer

A rigid body transformation has a rotation RR and a translation t\mathbf{t}, combined as g(p)=Rp+tg(\mathbf{p}) = R\mathbf{p} + \mathbf{t}. It preserves every distance between points on the object, because the translation cancels in differences and the rotation preserves lengths.

QuestionApply the rigid transformation with rotation of 90∘90^\circ counterclockwise and translation (2,1)(2, 1) to the point (1,0)(1, 0).Show answer

The rotation of (1,0)(1, 0) by 90∘90^\circ counterclockwise is (0,1)(0, 1). Adding the translation gives (0,1)+(2,1)=(2,2)(0, 1) + (2, 1) = (2, 2).

QuestionWhy must the rotation matrix have determinant plus one rather than just be orthogonal?Show answer

An orthogonal matrix can have determinant minus one, and that is a reflection. Reflections preserve distances but swap left and right handed arrangements, so a robot using one would mirror its parts. Requiring determinant +1+1 restricts the motions to genuine rotations, which are the ones a physical body can perform.

QuestionA robot base is at (1,0,0)(1, 0, 0) and is rotated 90∘90^\circ about zz. A tool tip sits at (0.5,0,0.2)(0.5, 0, 0.2) in the base frame. Where is the tip in the world frame?Show answer

Rotating the tip gives (0,0.5,0.2)(0, 0.5, 0.2). Adding the base position gives (1,0.5,0.2)(1, 0.5, 0.2). The tip is at (1,0.5,0.2)(1, 0.5, 0.2) in the world, not at (1.5,0,0.2)(1.5, 0, 0.2), because the base rotation moves the tip's offset before the base translation is added.

Sources