MCIS 625: Computer Graphics
Winter 2004
WEEK 5
Instructor: Dr. Michael Laszlo
Understood most simply, geometric transformations are used to modify the shape, size, and orientation of graphical objects. The basic transformations are translation, scaling, and rotation. Although transformations make sense in any number of dimensions, the following assumes 2D transformations in the plane:
This kind of series of transformations occurs very often in modeling, viewing, and animation. Accordingly, it is useful to be able to able to represent the resulting net transformationthe result of any series of transformationsthe same way we represent the basic tranformations of translation, scaling, and rotation. This uniformity of representation means that we are able to apply a transformation in precisely the same way, and with the same degree of efficiency, whether that transformation is a basic one, or one that arises from a series of any number of other transformations.
A 2D transformation is represented by a 3x3 matrix of real numbers. To transform a point (x,y) in the plane, we represent the point in homogeneous coordinates by appending the value one as its third coordinate: (x,y,1). Then we premultiply the resulting 3-component point by the 3x3 matrix that represents the given transformation. The result is a new point (x',y',1) that is the new position of the original point in homogeneous coordinates. Details are provided in this week's reading assignment.
This arrangement may appear unnecessarily complicated. Why not use a 2x2 matrix to represent a transformation, and simply premultiply this matrix by the point to be transformed to obtain a new 2-component point? Why must we resort to homogeneous coordinates? The reason is that, although basic rotation and scaling can be represented by 2x2 matrices, translation cannot. Translation in 2D requires the use 3x3 matrices and homogeneous coordinates. The use of homogeneous coordinates satisfies our requirement that any transformation be represented the same way.
Note that general rotation around an arbitrary point (x,y) is represented by a 3x3 matrix, as we would expect. (The actual matrix is labeled (5.30) on page 176 of our text.) This matrix is obtained by multiplying together the three matrices corresponding to the three transformations listed in the series above:
T(x,y)×R(θ)×T(-x,-y)In other words, the matrices are composed. Similarly, we sometimes speak of composing transformations.
Because matrix multiplication is associative, either of the two multiplications can be carried out first; that is,
(T(x,y)×R(θ))×T(-x,-y) = T(x,y)×(R(θ)×T(-x,-y))However, because matrix multiplication is not commutative, the order of the matrices must remain unchanged.
Transformations in 3D are represented by 4x4 matrices, and points in 3D are appended by a one: (x,y,z,1). This is analogous to 2D transformations, one dimension higher. However, in 3D we have three basic rotations, one around each of the three major axes x, y, and z.