Professional Documents
Culture Documents
Row * Col
The geometric-transformation functions, which are available in all
graphics packages are those for translation, rotation, and scaling.
Other useful transformation routines, which are sometimes included in a
package are reflection and shearing operations
2D Translation is a process of moving an object from one position to another in a two
dimensional plane.
To translate a two-dimensional position, we add translation distances (tx) and (ty) to the
original coordinates (xold, yold) to obtain the new coordinate position (xnew, ynew).
The translation distance pair (tx, ty) is called a translation vector or shift vector.
We can express Equations (1) as a single matrix equation by using the following
column vectors to represent coordinate positions and the translation vector:
xnew = xold + tx ynew = yold + ty
Translation is a rigid-body transformation, which moves objects without deformation.
That is, every point on the object is translated by the same amount.
A straight-line segment is translated by applying the equation to each of the two line
endpoints and redrawing the line between the new endpoint positions.
Similarly, to translate a polygon we add a translation vector to the coordinate position of
each vertex and then regenerate the polygon using the new set of vertex coordinates.
Moving a polygon from position (a) to position (b) with the translation vector (−5.50, 3.75).
Moving a circle from position (a) to position (b) with the translation vector (5, 1).
Xnew = Xold + Tx = 1 + 5 = 6
Ynew = Yold + Ty = 4 + 1 = 5
Let the new coordinates of corner A Let the new coordinates of corner B Let the new coordinates of corner C
after rotation = (Xnew, Ynew). after rotation = (Xnew, Ynew). after rotation = (Xnew, Ynew).
Xnew= Xold * cosθ – Yold * sinθ= Xnew= Xold * cosθ – Yold * sinθ= 1 x Xnew= Xold x cosθ – Yold * sinθ= 1 *
0 * cos90º – 0 x sin90º= 0 cos90º – 0 * sin90º= 0 cos90º – 1 * sin90º= 0 – 1= -1
Ynew= Xold x sinθ + Yold x cosθ= 0 * Ynew= Xold *sinθ + Yold * cosθ= 1*sin90º Ynew= Xold * sinθ + Yold * cosθ= 1 *
sin90º + 0 * cos90º= 0 + 0 * cos90º= 1 + 0= 1 sin90º + 1 * cos90º= 1 + 0= 1
Thus, New coordinates of corner A Thus, New coordinates of corner B Thus, New coordinates of corner C
after rotation = (0, 0). after rotation = (0, 1). after rotation = (-1, 1).
Thus, New coordinates of the triangle after rotation = A (0, 0), B(0, 1), C(-1, 1).
Scaling is a process of modifying or altering the size of objects.
Scaling may be used to increase or reduce the size of object.
Scaling subjects the coordinate points of the original object to change.
Scaling factor determines whether the object size is to be increased or reduced.
If scaling factor > 1, then the object size is increased.
If scaling factor < 1, then the object size is reduced.
Initial coordinates of the object O = (Xold, Yold)
Scaling factor for X-axis = Sx
Scaling factor for Y-axis = Sy
New coordinates of the object O after scaling = (Xnew, Ynew)
This scaling is achieved by using the following scaling equations-
Xnew = Xold * Sx
Ynew = Yold * Sy
Given a square object with coordinate points A(0, 3), B(3, 3), C(3, 0), D(0, 0). Apply the scaling
parameter 2 towards X axis and 3 towards Y axis and obtain the new coordinates of the object.
Given: Scaling factor along X axis = 2, Scaling factor along Y axis = 3
For Coordinates A(0, 3) For Coordinates B(3, 3)
Xnew = Xold + Shx * Yold = 1 + (2 * 1) Xnew = Xold + Shx * Yold = 0 + (2 * Xnew = Xold + Shx * Yold = 1 + 2 * 0 = 1
=3 0) = 0
Ynew = Yold = 0
Ynew = Yold = 1 Ynew = Yold = 0
Thus, New coordinates of corner C
Thus, New coordinates of corner Thus, New coordinates of corner B
A after shearing = (3, 1). after shearing = (0, 0). after shearing = (1, 0).
Ynew = Yold + Shy * Xold = 1 + 2 * Ynew = Yold + Shy * Xold = 0 + 2 * Ynew = Yold + Shy * Xold = 0 + 2* 1
1=3 0=0 =2
Thus, New coordinates of Thus, New coordinates of Thus, New coordinates of corner
corner A after shearing = (1, 3). corner B after shearing = (0, 0) C after shearing = (1, 2).