Unit II - 2D and 3D Transformation
Unit II - 2D and 3D Transformation
2D Transformation
Introduction to Polygon
● Polygon is a representation of the surface. It is primitive which is closed in nature. It is
formed using a collection of lines. It is also called as many-sided figure. The lines
combined to form polygon are called sides or edges. The lines are obtained by
combining two vertices.
2. Convex Polygon:
Line segment joining any two points within
polygon lie completely inside the polygon
Example:
P2 = P1 * T
Where P2- resultant matrix, P1- input matrix & T- transformation matrix
Sx=2, Sy=2
0 Sy 0 7 10 1
0 0 1 10 2 1
P2 = P1 * T
2 5 1 2 0 0
=
7 10 1 0 2 0
10 2 1
* 0 0 1
4 10 1
=
14 20 1
20 4 1
Tx=3, Ty=4
Matrix P1 Matrix
1 0 0 2 5 1
0 1 0 7 10 1
Tx Ty 1 10 2 1
P2 = P1 * T
2 5 1 1 0 0
=
7 10 1 0 1 0
10 2 1
* 3 4 1
5 9 1
=
10 14 1
13 6 1
P2= P1 * T
0 0 1 1/√2 -1/√2 0
= *
1 1 1 1/√2 1/√2 0
5 2 1 0 0 1
0 0 1
= √2 0 1
7/√2 -3/√2 1
Cos 45 Sin 45 0
= - sin 45 Cos Ɵ 0
-(-1) cos 45 + (-1)sin 45 +(-1) -(-1) sin 45- (-1) cos (-1) +(-1) 1
1 1 1 1/√2 1/√2 0
5 2 1 0 0 1
Cos 45 Sin 45 0
0 0 1
= - sin 45 Cos Ɵ 0
√2 0 1
-(-1) cos 45 + (-1)sin 45 +(-1) -(-1) sin 45- (-1) cos (-1) +(-1) 1
7/√2 -3/√2 1
= √2 -1 -1 1
√2 + √2 -1 -1 1
9/√2 -1 -3/√2 -1 1
Xnew = Xold Xnew = Zoldsinθ + Xold cosθ Xnew = Xoldcosθ – Yold sinθ
Ynew = Yold Ynew = Xoldsinθ + Yoldcosθ
Ynew = Yold cosθ – Zold sinθ
Znew = Yoldcosθ – Xoldsinθ Znew = Zold
Znew = Yold sinθ + Zold cosθ
40