Graphics / Reference / Translation as a matrix

Translation as a matrix

Homogeneous coordinates let 2D translation be expressed as a 3 by 3 matrix. The third coordinate turns constant translation offsets into terms proportional to w, and division by w recovers the translated Cartesian point.

Translation by vector (xo,yo) is represented in homogeneous 2D coordinates by:

[x';y';w'] = [1,0,xo;0,1,yo;0,0,1]*[x;y;w]

The multiplication gives:

x' = x + w*xo y' = y + w*yo w' = w

For w != 0, convert back to the represented Cartesian point by dividing through by w':

x'/w' = x/w + xo

y'/w' = y/w + yo

Thus the actual 2D point moves by exactly (xo,yo), regardless of which proportional homogeneous representation of the finite point is used.

For the standard embedding (x,y,1), the raw result is simply (x + xo,y + yo,1).

The standard diagram shows a rectangle and its translated copy with the displacement between corresponding positions labelled by the vector (xo,yo).

A rectangle and an identical shifted copy are connected by parallel displacement arrows labelled translation vector xo,yo equal to two,one.
Every rectangle vertex receives the same translation vector, so the shape and orientation are preserved while its position changes.

Builds on

Read

Playgrounds