Graphics Reference
In-Depth Information
7
Transformation
Transformations are used to scale, translate, rotate, reflect and shear shapes
and objects. And, as we shall discover shortly, it is possible to effect this by
changing their coordinate values.
Although algebra is the basic notation for transformations, it is also possi-
ble to express them as matrices , which provide certain advantages for viewing
the transformation and for interfacing to various types of computer graphics
hardware. We begin with an algebraic approach and then introduce matrix
notation.
7.1 2D Transformations
7.1.1 Translation
Cartesian coordinates provide a one-to-one relationship between number and
shape, such that when we change a shape's coordinates, we change its geome-
try. For example, if P ( x, y ) is a vertex on a shape, when we apply the operation
x = x + 3 we create a new point P ( x ,y ) three units to the right. Similarly,
the operation y = y + 1 creates a new point P ( x, y ) displaced one unit ver-
tically. By applying both of these transforms to every vertex to the original
shape, the shape is displaced as shown in Figure 7.1.
7.1.2 Scaling
Shape scaling is achieved by multiplying coordinates as follows:
x =2 x
y =1 . 5 y
(7.1)
Search WWH ::




Custom Search