COMPUTER GRAPHICS
TRANSFORMATIONS
Many of the editing features involve transformations of the graphics
elements or cells composed of elements or even the entire model. In this section we
discuss the mathematics of these transformations. Two-dimensional transformations
are considered first to illustrate concepts. Then we deal with three dimensions.
Two-dimensional transformations
To locate a point in a two-axis cartesian system, the x and y coordinates are
specified. These coordinates can be treated together as a 1x1 matrix: (x,y). For
example, the matrix (2, 5) would be interpreted to be a point which is 2 units from
the origin in the x-direction and 5 units from the origin in the y-direction.
This method of representation can be conveniently extended to define a line
as a 2 x 2 matrix by giving the x and y coordinates of the two end points of the line.
The notation would be
x 1 y1
L=
x y
2 2
Using the rules of matrix algebra, a point or line (or other geometric element
represented in matrix notation) can be operated on by a transformation matrix to
yield a new element.
There are several common transformations used in computer graphics. We
will discuss three transformations: translation, scaling, and rotation.
TRANSLATION. Translation involves moving the element from one
location to another. In the case of a point, the operation would be
x' =x + m, y' = y + n
where x', y' = coordinates of the translated point
x, y = coordinates of the original point
m, n = movements in the x and y directions, respectively
In matrix notation this can be represented as
,(x', y') = (x, y) + T
, where
T = (m,n), the translation matrix
Any geometric element can be translated in space by applying Eq. to each
point that defines the element. For a line, the transformation matrix would be applied
to its two end points.
SCALING. Scaling of an element is used to enlarge it or reduce its size. The
scaling need not necessarily be done equally in the x and y directions. For example, a
circle could be transformed into an ellipse by using unequal x and y scaling factors.
The points of an element can be scaled by the scaling matrix as follows:
(x' ,y') = (x,y)S
where
m 0 the scaling matrix
s
0 n