Graphics / Reference / Homogeneous coordinates

Homogeneous coordinates

Homogeneous coordinates represent a 2D point with a triple (x,y,w), allowing translation to be expressed as matrix multiplication. Finite points are recovered by dividing by w; non-zero triples with w = 0 represent points at infinity.

A simple 2 by 2 matrix cannot represent translation x' = x + xo, y' = y + yo because it has no constant term and always maps the origin to the origin. Homogeneous coordinates add a third coordinate.

For w != 0, homogeneous coordinate (x,y,w) represents the ordinary 2D point:

(x/w,y/w)

Therefore proportional triples represent the same point. For example, (2,3,1), (4,6,2) and (10,15,5) all represent (2,3). There are infinitely many such representations for every finite 2D point.

The standard embedding from ordinary 2D coordinates is:

(x,y) -> (x,y,1)

A non-zero homogeneous triple with w = 0 cannot be divided back to a finite Cartesian point and represents a point at infinity in homogeneous geometry. The all-zero triple (0,0,0) is not a valid homogeneous point.

In a later four-component graphics representation, a 2D position is expanded to vec4(x,y,0,1): z = 0 embeds the 2D point, and w = 1 marks it as an ordinary position so translation affects it. The model matrix is applied first, followed by the projection matrix.

Builds on

Read

Playgrounds