In Graphics, Once We Have An Object Described, Transformations Are Used To Move That Object, Scale It and Rotate It
In Graphics, Once We Have An Object Described, Transformations Are Used To Move That Object, Scale It and Rotate It
y 6
0
1 2 3 4 5 6 7 8 9 10
x
Note: House shifts position relative to origin
B.Tulasi, Dept Of CS,Christ University 2
Bangalore
Scaling
xnew = Sx × xold ynew = Sy × yold
y
6
3 6 9
3 3
2
1 2 3
1 1
0
1 2 3 4 5 6 7 8 9 10
x
Note: House shifts position relative to origin
y
6
2
1 6
0
1 2 3 4 5 6 7 8 9 10
x
1 0 dx x x dx
0 1 dy y y dy : v' T (dx, dy )v
Translation:
0 0 1 1 1
Rotation:
1 0 dx
1 1
T 0 1 dy s 0 0
0 0 1 x
1 1
S 0 0
cos sin 0 sy
1 0 0 1
R sin cos 0
0
0 1
B.Tulasi, Dept Of CS,Christ University 10
Bangalore
Combining Transformations
A number of transformations can be combined
into one matrix to make things easy
◦ Allowed by the fact that we use homogenous
coordinates
Imagine rotating a polygon around a point
other than the origin
◦ Transform to centre point to origin
◦ Rotate around origin
◦ Transform back to centre point
R ( )T ( dx , dy ) H T ( dx, dy ) R ( )T ( dx, dy ) H
3 4
B.Tulasi, Dept Of CS,Christ University 12
Bangalore
Combining Transformations
Thethree transformation matrices are
combined as follows
1 0 dx cos sin 0 1 0 dx x
0 1 dy sin cos 0 0 1 dy y
0 0 1 0 0 1 0 0 1 1