Chapter 4
Chapter 4
Matrix Representation
Transformation
2d transformations
Chapter 4
3d transformations
Geometrical Transformations Homogeneous Coordinates
Combination of Transformations
= =
Sx 0 0
S 0 Sy 0
0 0 1
px S x 0 0 p x
py 0 Sy 0 p y
Therefore px p x cos p y sin and p y p y cos p y sin , which is the same outcome as before. 1 0 0 1 1
Examples Cont...
Given a square with vertices at p1 = (10, 15), p2 = (15, 15), p3 = (15, 20) and p4 = (10,
20). Translate the points by (10, 5) using translation matrix. P3 = (15, 20)
Solution:
Tx = 10, Ty = 5
P4 = (10, 20)
P1 = (10, 15)
P2 = (15, 15)
For reflection axes that are perpendicular to the xy plane, the rotation path is in the xy plane.
Reflection about the line y = 0, the x axis, is accomplished with the transformation matrix:
Example 2 Cont..
Problem- For Coordinates A(0, 3, 1)
Given a 3D object with coordinate points A(0, 3, 1), B(3, 3, 2), C(3, 0, 0), D(0,
Let the new coordinates of A = (Xnew, Ynew, Znew).
0, 0). Apply the translation with the distance 1 towards X axis, 1 towards Y
axis and 2 towards Z axis and obtain the new coordinates of the object. Applying the translation equations, we have-
Xnew = Xold + Tx = 0 + 1 = 1
Solution- Ynew = Yold + Ty = 3 + 1 = 4
Given-
Znew = Zold + Tz = 1 + 2 = 3
Old coordinates of the object = A (0, 3, 1), B(3, 3, 2), C(3, 0, 0), D(0, 0, 0)
Translation vector = (Tx, Ty, Tz) = (1, 1, 2) Thus, New coordinates of A = (1, 4, 3).
Cont.. Cont..
For Coordinates D(0, 0, 0) Example: A point has coordinates in
the x, y, z direction i.e., (5, 6, 7).
Let the new coordinates of D = (Xnew, Ynew, Znew).
The translation is done in the x-
Applying the translation equations, we have- direction by 3 coordinate and y
Xnew = Xold + Tx = 0 + 1 = 1 direction.
Three coordinates and in the z-
Ynew = Yold + Ty = 0 + 1 = 1
direction by two coordinates.
Znew = Zold + Tz = 0 + 2 = 2 Shift the object. Find coordinates of
the new position.
Thus, New coordinates of D = (1, 1, 2).
Cont.. Cont..
• steps performed when scaling of Note: If all scaling factors Sx=Sy=Sz.Then scaling is
objects with fixed point (a, b, c). called as uniform Scaling.
If scaling is done with different scaling vectors, it is called a
1. Translate fixed point to the origin differential scaling.
2. Scale the object relative to the origin
3. Translate object back to its original
position.
Cont.. Cont..
For Coordinates B(3, 3, 6) For Coordinates C(3, 0, 1)
Let the new coordinates of B after scaling = (Xnew, Ynew, Znew). Let the new coordinates of C after scaling = (Xnew, Ynew,
Applying the scaling equations, we have- Znew).
Xnew = Xold x Sx = 3 x 2 = 6 Applying the scaling equations, we have-
CONT… CONT…
For Y-Axis Rotation-
This rotation is achieved by using the following rotation equations-
Xnew = Zold * sinθ + Xold * cosθ
Ynew = Yold
Znew = Yold * cosθ – Xold * Sinθ
Example
End of chapter 4