Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
Matrices and Transforms  ›  Capstone Project

Affine Transformations: Placing Things in the World

Affine Transformation 15 minAn affine transformation is a linear transformation followed by a translation, packed into one 3-by-3 matrix that moves points but not directions, normally built as translate times rotate times scale.

Affine Transformations: Placing Things in the World

The artist drew the crate once, centred on its own little origin, with corners one unit from the middle. The level wants a big version of it, tipped on its side and sitting at (10,3)(10, 3) on the quay. Getting from the drawing to the world takes a scale, a rotation and a slide, and the order you do them in matters.

The rule

Scale, rotate, then translate: write it T·R·S, read right to left.

An affine transformation is a linear transformation followed by a slide, called a translation: p′=Ap+t\mathbf{p}' = A\mathbf{p} + \mathbf{t}. A slide on its own isn't linear, because it moves the origin. The ww coordinate from the last lesson lets one 3×3 matrix do both at once:

[abtxcdty001][xyw]=[ax+by+w txcx+dy+w tyw]\begin{bmatrix} a & b & t_x \\ c & d & t_y \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} x \\ y \\ w \end{bmatrix} = \begin{bmatrix} ax + by + w\,t_x \\ cx + dy + w\,t_y \\ w \end{bmatrix}

For a point, w=1w = 1 and the slide is added. For a vector, w=0w = 0 and the slide vanishes. That's exactly what you want: moving a crate changes where its corners are, but not which way it faces.

The standard recipe is to scale first (about the object's own centre), then rotate (still about that centre), then translate it into place. Written as one product that is M=T R SM = T\,R\,S, and a point meets S first.

The shortcut

Read the finished matrix like a label. Its last column is where the object's local origin lands, which is its position in the world. Its first two columns are its x and y axes after scaling and rotating.

Placing the big crateStep 1 of 5
  1. Scale by 2

    The corner (1, 1) becomes (2, 2).

Now do the steps in the wrong order. Translate (1, 1) first, to (11, 4); rotate it, to (−4, 11); scale it, to (−8, 22). The crate has swung around the world origin and ended up far from the quay, 22 m up in the sky. Translating before rotating is the classic "my object orbits instead of spinning" bug.

Drills

Answer fast — trust the rule.

quick drill

A crate's world matrix has rows (0, −2, 10), (2, 0, 3) and (0, 0, 1). Where is the crate's local origin in the world?

With the same matrix, what is the world x of the local point (0, 1)?
0×0+(−2)×1+10= ?0 \times 0 + (-2) \times 1 + 10 = \,?
quick drill

The drone's forward direction is (1, 0, 0). You apply a translation by (5, 2). What does the direction become?

quick drill

A crate is first translated to (10, 3) and then rotated 90° counter-clockwise about the origin. Where does its centre end up?

quick drill

In M = T · R · S, which transformation does a point meet first?

Remember

  • Affine = linear, then a slide; a 3×3 matrix with a w coordinate does both at once.
  • Scale, rotate, translate: M = T·R·S, applied right to left; the last column is the position.
  • Points (w = 1) slide and directions (w = 0) don't. Translating first makes objects orbit the origin.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainBuild the big crate's world matrix

Explain how to build the world matrix for a crate that is scaled 2×, turned 90° counter-clockwise and placed at (10, 3). Say why the order is scale, rotate, translate, and what happens to its corner (1, 1) if you translate first.