Skip to content
Part IA Michaelmas Term

2D Transformations

Why Transformations?

Transformations allow us to:

  • Place predefined objects at arbitrary locations, orientations, and sizes
  • Build complex scenes from simple primitives
  • Animate objects over time

Basic object transformed to multiple instances in a scene

Basic Transformations

Scale (about origin, factor mm)

x=mx,y=myx' = mx, \quad y' = my

Rotate (about origin, angle θ\theta)

x=xcosθysinθx' = x\cos\theta - y\sin\theta y=xsinθ+ycosθy' = x\sin\theta + y\cos\theta

Translate (by vector (xo,yo)(x_o, y_o))

x=x+xo,y=y+yox' = x + x_o, \quad y' = y + y_o

Shear (parallel to x-axis, factor aa)

x=x+ay,y=yx' = x + ay, \quad y' = y

Matrix Representation

2×2 matrices work for scale, rotate, and shear, but not translation.

Scale: [xy]=[m00m][xy]\begin{bmatrix} x' \\ y' \end{bmatrix} = \begin{bmatrix} m & 0 \\ 0 & m \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix}

Rotate: [xy]=[cosθsinθsinθcosθ][xy]\begin{bmatrix} x' \\ y' \end{bmatrix} = \begin{bmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix}

Identity: [xy]=[1001][xy]\begin{bmatrix} x' \\ y' \end{bmatrix} = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix}

The Translation Problem

Translation cannot be represented as 2×2 matrix multiplication: [xy]=[xy]+[xoyo]\begin{bmatrix} x' \\ y' \end{bmatrix} = \begin{bmatrix} x \\ y \end{bmatrix} + \begin{bmatrix} x_o \\ y_o \end{bmatrix}

This breaks uniformity—other transforms are multiplicative.

Summary

  • Scale, rotate, and shear can be expressed as matrix multiplication
  • Translation requires an additive term (not multiplicative)
  • This motivates homogeneous coordinates