Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
(2)
Y=Y+ty;
(1)
Now similar to thus transformation we have to perform many other transformations , this leads
to generation many other equations like eqn 1,2
Thus during programming this may cause lot of problems as code may become lengthy and
complex
Thus we convert these equations in matrix form such as given below..
X= ;
.(Initial position )
T = ;
.( Translation coordinates)
X =
.( New coordinates)
Thus,
= +
;
X=X+T ;
Rotation :
A two dimensional rotation is rotation of an object about a single point along a circular path
constrained about a given angle..
`A 2-D rotation can also be described as rotation of object about an axis about an axis
perpendicular to xy plane and fixed at the pivot point..
Now in this transformation we take input as the pivot coordinate(x,y) and the angle through
which the object is to be rotated..
Lets first consider (xr,yr) to (0,0)
So according to the above diagram we can form the equations such as ..
x = r*Cos( + ) = () () () () ;
(3)
y = r*Sin( + ) = () () () () ;
(4)
Orignal point ,
x = r*Cos() ;
(5)
y = r*Sin() ;
(6)
(7)
y = () + () ;
(8)
P= ;
P =
R=
() ()
;
() ()
(9)
Y = xr +( ) () ( ) () ;
(10)
Thus,
The matrix form is :
P = Pr - R * Pr + R * P ;
Scaling :
Scaling transformation alters the size of the object . This operation is carried out by multiplying
the coordinates with scaling factors sx,sy .
Thus equations can be written as ,
x =sx * x;
y =sy * y;
Scaling matrix= S =
0
0
;
P = S * P ;
Any positive values can be assigned to scaling factors sx ,sy .
If sx,sy are less than 1 then the object is shifted close to origin and becomes smaller in size than the
original object ..
And if the factors are greater than 1 then magnification occurs and the object moves away from the
origin..
If the scaling factors are equal in magnitude i.e sx=sy then the condition is called as uniform
scaling..This scaling alters the object in equal relative proportions w.r.t the object..
As the scaling occurs wrt to the origin we can also change the scaling point by using the
modified equations ..
Let the point via which the scaling has to occur be (xs,ys)
Thus,
x = x +xs ;
y = y + ys;
but here x = sx * (x w.r.t xs);
y =sy * (y w.r.t ys);
x = sx(x-xs) + xs ;
y =sy*(y-ys) + ys;
If sx!=sy then non uniform transformation can be caused..That is we can covert a square to a
rectangle by using appropriate scaling transformations..