What is transformation? In many cases a complex picture can always be treated as a combination of straight line, circles, ellipse etc. and if we are able to generate these basic figures, we can also generate combinations of them. Once we have drawn these pictures, the need arises to transform these pictures.
We are not essentially modifying the pictures, but a picture in the center of the screen needs to be shifted to the top left hand corner, say, or a picture needs to be increased to twice it's size or a picture is to be turned through 90 0. In all these cases, it is possible to view the new picture as really a new one and use algorithms to draw them, but a better method is, given their present form, try to get their new counter parts by operating on the existing data. This concept is called transformation.
The three basic transformations are
(ii) rotation and
Translation refers to the shifting of a point to some other place, whose distance with regard to the present point is
known. Rotation as the name suggests is to rotate a point about an axis. The axis can be any of the coordinates or simply any other specified line also. Scaling is the concept of increasing (or decreasing) the size of a picture. (in one or in either directions. When it is done in both directions, the increase or decrease in both directions need not be same) To change the size of the picture, we increase or decrease the distance between the
end points of the picture and also change the intermediate points are per requirements.
Consider a point P(x 1. y 1 ) to be translated to another point Q(x 2. y 2 ). If we know the point value (x 2 , y 2 ) we can directly shift to Q by displaying the pixel (x 2. y 2 ). On the other hand, suppose we only know that we want to shift by a distance of Tx along x axis and Ty along Y axis. Then obviously the coordinates can be derived by x 2 =x 1 +T x and Y 2 = y 1 + T y.
Suppose we want to shift a triangle with coordinates at A(20,10), B(30,100) and C(40,70). The shifting to be done by 20 units along x axis and 10 units along y axis. Then the new triangle will be at A 1 (20+20, 10+10) B 1 (30+20, 10+10) C 1 (40+20, 70+10) In the matrix form [x 2 y 2 1] = [x 1 y 1 1]
Suppose we want to rotate a point (x1 y1) clockwise through an angle? about the origin of the coordinate system. Then mathematically we can show that
x2 = x1cos. + y1sin? and
y2 = x1sin? - y1cos?
These equations become applicable only if the rotation is about the origin.
In the matrix for [x2 y2 1] = [x1 y1 1]
Scaling : Suppose we want the point (x1 y1 ) to be scaled by a factor sx and by a factor sy