CG Assignment 2
Sayan Maiti
CSE/17/18
Use homogeneous co-ordinate system to solve the following problems:
1. Magnify a rectangle A (3,3), B (7,3), C (7,8), D (3,8) twice of its width and thrice of its height while keeping
A (3,3) fixed to obtain a new rectangle A'B'C'D'.
2. Now rotate the magnified rectangle A'B'C'D' by 90-degree CCW w.r.t point D'. Show the final result.
Ans:
Part-1:
Given, A (3,3) B (7,3) C (7,8) D (3,8)
Therefore, the given points in homogenous coordinate will be given by
A (3 3 1) B (7 3 1) C (7 8 1) D (3 8 1)
It is to be scaled keeping A fixed.
Now, the transformation matrix for the fixed-point scaling is given by
1 0 0 2 0 0 1 0 0
Sf = [0 1 0 ] . [0 3 0 ] . [0 1 0]
−3 −3 1 0 0 1 3 3 1
2 0 0 1 0 0
= [0 3 0 ] . [0 1 0]
−6 −9 1 3 3 1
2 0 0
= [0 3 0]
−3 −6 1
Now,
P’ = P. Sf
3 3 1
2 0 0
7 3 1
= [ ].[ 0 3 0]
7 8 1
−3 −6 1
3 8 1
3 3 1
11 3 1
= [ ]
11 18 1
3 18 1
Therefore, the modified coordinates are
A’ (3,3) B’ (11, 3) C’ (11,18) D’ (3,18)
Part-2
The magnified rectangle A’B’C’D’ is to be rotated 90o counter clockwise with respect to vertex D
Then the transformation matrix is given by,
Rm = 𝑇(−3, −18). 𝑇(𝜃). 𝑇(3,18)
1 0 0 cos 90 sin 90 0 1 0 0
= [0 1 0] . [−sin 90 cos 90 0] . [0 1 0]
−3 −18 1 0 0 1 3 18 1
0 1 0 1 0 0
= [−1 0 0] . [0 1 0]
18 −3 1 3 18 1
0 1 0
= [−1 0 0]
21 15 1
Now,
𝑃′ = 𝑃. 𝑅𝑚
3 3 1
0 1 0
11 3 1
=[ ] . [−1 0 0]
11 18 1
21 15 1
3 18 1
18 18 1
18 26 1
=[ ]
3 26 1
3 18 1
Therefore, the coordinates of the rotated rectangle are
A’’ (18,18) B’’ (18,26) C’’ (3,26) D’’ (3,18)