i
i
i
i
i
i
i
i
54 4. Transforms
However, this size of matrix is usually not large enough. A function for a
three element vector x such as f(x)=x+(7, 3, 2) is not linear. Performing
this function on two separate vectors will add each value of (7, 3, 2) twice
to form the result. Adding a fixed vector to another vector performs a
translation, e.g., it moves all locations by the same amount. This is a
useful type of transform, and we would like to combine various transforms,
e.g., scale an object to be half as large, then move it to a different location.
Keeping functions in the simple forms used so far makes it difficult to easily
combine them.
Combining linear transforms and translations can be done using an
affine transform, typically stored as a 4 ×4 matrix. An affine transform is
one that performs a linear transform and then a translation. To represent
4-element vectors we use homogeneous notation, denoting points and direc-
tions in the same way (using bold lowercase letters). A direction vector is
represented as v =(v
x
v
y
v
z
0)
T
and a point as v =(v
x
v
y
v
z
1)
T
.
Throughout the chapter, we will make extensive use of the terminology
explained in Appendix A. You may wish to review this appendix now,
especially Section A.4, page 905, on homogeneous notation.
All translation, rotation, scaling, reflection, and shearing matrices are
affine. The main characteristic of an affine matrix is that it preserves
the parallelism of lines, but not necessarily lengths and angles. An affine
transform may also be any sequence of concatenations of individual affine
transforms.
This chapter will begin with the most essential, basic affine trans-
forms. These are indeed very basic, and this section could be seen as a
“reference manual” for simple transforms. More specialized matrices are
then described, followed by a discussion and description of quaternions,
a powerful transform tool. Then follows vertex blending and morphing,
which are two simple but more powerful ways of expressing animations
of meshes. Finally, projection matrices are described. Most of these
transforms, their notations, functions, and properties are summarized in
Table 4.1.
Transforms are a basic tool for manipulating geometry. Most graphics
application programming interfaces (APIs) include matrix operations that
implement many of the transforms discussed in this chapter. However, it
is still worthwhile to understand the real matrices and their interaction
behind the function calls. Knowing what the matrix does after such a
function call is a start, but understanding the properties of the matrix
itself will take you further. For example, such an understanding enables
you to discern when you are dealing with an orthogonal matrix, whose
inverse is its transpose (see page 904), making for faster matrix inversions.
Knowledge like this can lead to accelerated code.