Skip to content
Part IA Michaelmas Term

Homogeneous Coordinates

The Problem

Translation cannot be represented as a 2×2 matrix multiplication on 2D vectors. We need an additive term.

The Solution

Add a third coordinate ww:

2D point (x,y)Homogeneous (x,y,1)\text{2D point } (x, y) \equiv \text{Homogeneous } (x, y, 1)

More generally: (x,y,w)(xw,yw)(x, y, w) \equiv \left(\frac{x}{w}, \frac{y}{w}\right)

Properties

An infinite number of homogeneous coordinates map to each 2D point:

  • (1,2,1)(2,4,2)(3,6,3)(1, 2, 1) \equiv (2, 4, 2) \equiv (3, 6, 3)

When w=0w = 0: Point at infinity (direction vector).

Transformation Matrices

Scale (factor mm)

[xyw]=[m000m0001][xyw]\begin{bmatrix} x' \\ y' \\ w' \end{bmatrix} = \begin{bmatrix} m & 0 & 0 \\ 0 & m & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} x \\ y \\ w \end{bmatrix}

Rotate (angle θ\theta)

[xyw]=[cosθsinθ0sinθcosθ0001][xyw]\begin{bmatrix} x' \\ y' \\ w' \end{bmatrix} = \begin{bmatrix} \cos\theta & -\sin\theta & 0 \\ \sin\theta & \cos\theta & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} x \\ y \\ w \end{bmatrix}

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

[xyw]=[10xo01yo001][xyw]\begin{bmatrix} x' \\ y' \\ w' \end{bmatrix} = \begin{bmatrix} 1 & 0 & x_o \\ 0 & 1 & y_o \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} x \\ y \\ w \end{bmatrix}

Shear (factor aa)

[xyw]=[1a0010001][xyw]\begin{bmatrix} x' \\ y' \\ w' \end{bmatrix} = \begin{bmatrix} 1 & a & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} x \\ y \\ w \end{bmatrix}

Effects of each transformation on a square

3D Homogeneous Coordinates

A 3D point (x,y,z)(x, y, z) is represented as (x,y,z,w)(x, y, z, w): (x,y,z,w)(xw,yw,zw)(x, y, z, w) \equiv \left(\frac{x}{w}, \frac{y}{w}, \frac{z}{w}\right)

Points vs Vectors

TypewwAffected by Translation?
Point1Yes
Vector0No

Vectors represent directions and should not be translated.

Summary

  • Homogeneous coordinates add ww to represent translation as matrix multiplication
  • Points: w=1w = 1; Vectors: w=0w = 0
  • All affine transforms are now uniform matrix multiplications