Next / Previous / Contents / Shipman's homepage

2. The underlying mathematics

The basic idea behind homogeneous coordinates is to use a triple (x,y,W) to represent a point (x,y), where W is any nonzero value. Refer to Foley and van Dam's book for the reasoning. Here we will concern ourselves only with the mechanics.

To convert a regular Cartesian coordinate pair (x,y) into a triple, just use W=1. So, for example, point (3.4, -2.2) is represented as the triple (3.4, -2.2, 1.0).

The various transformations may yield triples whose W value is not 1.0. To convert such a triple back to Cartesian coordinates, divide through by the W value, so the result is (x/W, y/W) in Cartesian space. Clearly, we do not allow W=0.

All coordinate transformations can be represented as a combination of these three basic transforms:

Each of the above transformations can be represented as a matrix operation. Let a point P be represented by a 3-element vector (x,y,W). Then the transformed point P' is given by:

Here are the transform matrices for the three basic transformations. Td is a translation by the addition of dx to x and the addition of dy to y.

Scaling, multiplying each x value by sx, and multiplying each y value by sy:

Rotation by an angle θ: