Page 115 - Computer Graphics Handout
P. 115
3.8 TRANSLATION, ROTATION, AND SCALING
We have been going back and forth between looking at geometric objects as abstract entities and working with their representation
in a given frame. When we work with application programs, we have to work with representations. In this section, first we
show how we can describe the most important affine transformations independently of any representation. Then, we find matrices
that describe these transformations by acting on the representations of our points and vectors. In Section 3.8, we will see how these
transformations can be implemented in OpenGL. We look at transformations as ways of moving the points that describe one or
more geometric objects to new locations. Although there are many transformations that will move a particular point to a new
location, there will almost always be only a single way to transform a collection of points to new locations while preserving the
spatial relationships among them. Hence, although we can find many matrices that will move one corner of our color cube from P0
to Q0, only one of them, when applied to all the vertices of the cube, will result in a displaced cube of the same size
and orientation.
3.8.1 Translation
Translation is an operation that displaces points by a fixed distance in a given direction, as shown in Figure 3.33. To specify a
translation, we need only to specify a displacement vector d, because the transformed points are given by
P_ = P + d
for all points P on the object. Note that this definition of translation makes no reference to a frame or representation. Translation
has three degrees of freedom because we can specify the three components of the displacement vector arbitrarily.
3.8.2 Rotation
Rotation is more difficult to specify than translation because we must specify more parameters.
We start with the simple example of rotating a point about the origin in a two-dimensional plane,
as shown in Figure 3.34. Having specified a particular point—the origin—we are in a particular
frame. A two-dimensional point at (x, y) in this frame is rotated about the origin by an angle θ to
the position (x_ , y_). We can obtain the standard equations describing this rotation by representing
(x, y) and (x_ , y_) in polar form:
x = ρ cos φ,
y = ρ sin φ,
x_ = ρ cos(θ + φ),
y_ = ρ sin(θ + φ).
Expanding these terms using the trigonometric identities for the sine and cosine of the sum of two angles, we find
x_ = ρ cos φ cos θ − ρ sin φ sin θ = x cos θ − y sin θ ,
y_ = ρ cos φ sin θ + ρ sin φ cos θ = x sin θ + y cos θ .
These equations can be written in matrix form as
115

