Page 126 - DCAP313_LAB_ON_COMPUTER_GRAPHICS
P. 126
Lab on Computer Graphics
Notes Introduction
Transformations are a basic part of computer graphics. Transformations are used to place objects,
to form objects, to change viewing positions, and even to change how something is viewed
(e.g. the type of perspective that is used).(See figure 8.1)
Figure 8.1: 2D Transformation
In 3D graphics, we must use 3D transformations. However, 3D transformations can be quite
confusing so it helps to first start with 2D.
8.1 3D Transformation
There are four main forms of transformations that one can execute in 2 dimensions:
1. Translations
2. Scaling
3. Rotation
4. Shearing
These fundamental transformations can also be mingled to get more complex transformations.
In order to make the demonstration of these complex transformations easier to recognize and
more efficient, we introduce the idea of homogeneous coordinates.
Representation of Points/Objects
A point p in 2D is represented as a pair of numbers: p= (x, y) where x is the x-coordinate of
the point p and y is the y-coordinate of p. 2D objects are often represented as a set of points
(vertices), {p 1 , p 2 ,...,p n }, and an associated set of edges {e 1 ,e 2 ,...,em}. An edge is defined as a pair
of points e = {p i , p j }. What are the points and edges of the triangle below? (See figure 8.2)
Figure 8.2: Representation of Points
120 LOVELY PROFESSIONAL UNIVERSITY