Docsity

Transformations of Graphics, Lecture notes of Computer Graphics and Animation

Toggle sidebar
bg1
TRANSFORMATIONS
A transformation is a function that takes a point (or vector) and maps it into
another point (or vector). We can picture such a function by looking at Figure 4.32
or by writing down the functional form
Q = T(P) for points,
or v = R(u)
for vectors. If we use homogeneous coordinate representations, then we can
represent both vectors and points as four-dimensional column matrices, and we
can define the transformation with a single function,
q = f (p),
v = f (u),
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.
4.8.1 Translation
Translation is an operation that displaces points by a fixed distance in a given di-
rection, as shown in Figure 4.33. To specify a translation, we need only 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.
4.8.2 Rotation
pf3
pf4

Partial preview of the text

Download Transformations of Graphics and more Lecture notes Computer Graphics and Animation in PDF only on Docsity!

TRANSFORMATIONS

A transformation is a function that takes a point (or vector) and maps it into another point (or vector). We can picture such a function by looking at Figure 4. or by writing down the functional form

Q = T(P) for points,

or v = R(u)

for vectors. If we use homogeneous coordinate representations, then we can represent both vectors and points as four-dimensional column matrices, and we can define the transformation with a single function,

q = f (p),

v = f (u),

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 P 0 to Q 0 , 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.

4.8.1 Translation

Translation is an operation that displaces points by a fixed distance in a given di- rection, as shown in Figure 4.33. To specify a translation, we need only 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.

4.8.2 Rotation

Rotation is more complicated 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 4.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 0 3B 8 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 = 0 3C 1cos 0 3C 6 y = 0 3C 1sin 0 3C 6

x′ = 0 3C 1cos(θ + φ) y ′ = 0 3C 1sin(θ + φ).

Expanding these terms using the trigonometric identities for the sine and cosine of the sum of two angles, we find

x′ = 0 3C 1cos 0 3C 6 cos 0 3B 8− 0 3C 1sin 0 3C 6 sin 0 3B 8 = x cos 0 3B 8 − y sin 0 3B 8 ,

y′ = 0 3C 1cos 0 3C 6 sin 0 3B 8+ 0 3C 1sin 0 3C 6 cos 0 3B 8 = x sin 0 3B 8 + y cos 0 3B 8.

4.8.3 Scaling

Scaling is an affine non-rigid-body transformation by which we can make an object bigger or smaller. Figure 4.38 illustrates both uniform scaling in all directions and scaling in a single direction. We need nonuniform scaling to build up the full set of affine transformations that we use in modeling and viewing by combining a properly chosen sequence of scalings, translations, and rotations.

Scaling transformations have a fixed point, as we can see from Figure 4.39. Hence, to specify a scaling, we can specify the fixed point, a direction in which we wish to scale, and a scale factor (α). For 0 3B 1 > 1, the object gets longer in the specified direction; for 0 ≤ 0 3B 1 < 1, the object gets shorter in that direction. Negative values of 0 3 B 1 give us^ reflection^ (Figure 4.40) about the fixed point, in the scaling direction. Scaling has six degrees of freedom. Three independent values are needed to specify an arbitrary fixed point, and three more are needed to specify the magnitude and direction of scaling.

APPLICATION AREAS

  • the trackball of the mouse
  • the pitching, yawning and rotating of the plane

shown in Figure 5.9. Thus, the pyramid determined by the window in the projection plane and the center of projection is a symmetric or right pyramid. This symmetry is caused by the fixed relationship between the back (retina) and lens of the eye for human viewing, or between the back and lens of a camera for standard cameras, and by similar fixed relationships in most physical situations. Some cameras, such as the

5.8 HIDDEN-SURFACE REMOVAL

Before introducing a few additional examples and extensions of viewing, we need to deepen our understanding of the hidden-surface-removal process. Let’s start with the cube we have been using in our examples. When we look at a cube that has opaque sides, depending on its orientation, we see only one, two, or three front-facing sides. From the perspective of our basic viewing model, we can say that we see only these faces because they block the projectors from reaching any other surfaces.

From the perspective of computer graphics, however, all six faces of the cube have been specified and travel down the graphics pipeline; thus, the graphics system must be careful about which surfaces it displays. Conceptually, we seek algorithms that either remove those surfaces that should not be visible to the viewer, called hidden- surface-removal algorithms, or find which surfaces are visible, called visible-surface algorithms.