1.5.2. Homogeneous Coordinates
As explained above the matrix representation for translation, scaling and
rotation are:
P'=T+P
P'=S*P
P'=R*P
Unfortunately, translation is treated
as an addition whereas scaling and rotation as a multiplication. But we would
like to be able to treat all three transformations in a consistent way, so that
they can be combined easily.
The use of homogeneous coordinates allows
to treat all three transformations as multiplications. But what are homogeneous
coordinates?
In homogeneous coordinates, we add a
third coordinate to a point. Instead of being represented by a pair of numbers
(x,y), each point is represented by a triple (x,y,W). Two sets of homogeneous
coordinates (x,y,W) and (x',y',W') represent the same point if one is a multiple
of the other. Thus, (4,5,6) and (8,10,12) are the same points represented by
different coordinate triples. "That is,
each point has many different homogeneous coordinate representations. Also
one of the homogeneous coordinates must be nonzero: (0,0,0) is not allowed.
If the W coordinate is nonzero, we can divide by it: (x,y,W) represents the
same point as (x/W, y/W, 1). When W is nonzero, we normally do this
division, and the numbers x/W and y/W are called the cartesian coordinates
of the homogeneous point. The points with W=0 are called points of
infinity." (FOLEY et al. 1996, p. 204)
We are now using triples of coordinates, which normally represent points in 3D-space, to represent points in 2-D space. The intention is this: If we take all triples representing the same point (all triples are of the form (tx,ty,tW) with t unequal 0) we get a line in 3D-space. Therefore each homogeneous point represents a line in 3D-space. If we homogenise the point by dividing by W, we get a point of the form (x,y,1). Thus, the homogenized points form the plane defined by the equation W=1 in (x,y,W)-space. (FOLEY et al. 1996, p. 204-205)
The XYW homogeneous coordinate space, with the W=1 plane and point P(X,Y,W) projected onto the W=1 plane. According to (FOLEY et al. 1996)The translation can now be expressed as:
Translation matrix by using homogeneous coordinatesThe scale and rotation don't differ significantly in the notation showed above:
Scale matrix by using homogeneous coordinatesRotation matrix by using homogeneous coordinatesNow we are able to combine easily each operation by only calculating matrix products. Thus any sequence of transformations can be reduced to one single transformation matrix. The next chapter will show you an exemplary calculation.