0% found this document useful (0 votes)
126 views47 pages

CH 4

Chapter 4 discusses geometrical transformations, including matrix representation, 2D and 3D transformations, and homogeneous coordinates. It covers translation, rotation, scaling, and reflection transformations, providing examples for each. The chapter emphasizes the importance of matrix operations in performing these transformations in both two and three dimensions.

Uploaded by

kassaalex30
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
126 views47 pages

CH 4

Chapter 4 discusses geometrical transformations, including matrix representation, 2D and 3D transformations, and homogeneous coordinates. It covers translation, rotation, scaling, and reflection transformations, providing examples for each. The chapter emphasizes the importance of matrix operations in performing these transformations in both two and three dimensions.

Uploaded by

kassaalex30
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 47

Chapter 4

Geometrical Transformations

1 11/27/2023
Chapter 4 Geometrical Transformations

 Matrix Representation
 Transformation
 2d transformations
 3d transformations
 Homogeneous Coordinates
 Combination of Transformations

2 11/27/2023
Matrix Transformations
 First of all let us review some basics of matrices. 2x2 matrices can be
multiplied according to the following equation .

3 11/27/2023
CONT..
 Matrix multiplication is not commutative. In other words, for two matrices
A and B, AB≠BA. We can see this from the following example.

 However, matrix multiplication is associative. This means that if we have


three matrices A, B and C, then (AB)C = A(BC). We can see this from the
following example.

4 11/27/2023
1. 2D- Translation
 The translation transformation shifts all points by the same
amount.
 A translation is applied to an object by repositioning it along a straight-
line path from one coordinate location to another.
 therefore, in 2-D, we must define two translation
parameters:
 the x-translation tx
 the y-translation ty.

5 11/27/2023
CONT..
To translate a point P to P’ we add on a vector T:
 px 
P =  ………………………………………
p 
 y
 p′x 
P′ = 
 p′ 
 ………………………………………
 y
 tx 
T =  ………………………………………
t 
 y
 p′x   px   t x 
 = +  ………………………………
 p′   p  t 
 y   y  y
6 11/27/2023
Example translate the following triangle
 Given (2,3) ,(1,1),(3,1) and translation matrix =(3,1)

p′x = p x + t x
p′y = p y + t y
⇒ (2+3,3+1)=(5,4)
⇒ (1+3,1+1)=(4,2)
⇒ (3+3,1+1)=(6,2)

7 11/27/2023
2. 2-D Rotation
 The rotation transformation rotates all points about a center of rotation.
 Normally this center of rotation is assumed to be at the origin (0,0), although
as we will see later on it is possible to rotate about any point.
 The rotation transformation has a single parameter:
 The angle of rotation, θ.
 To rotate a point P anti-clockwise by θo, we apply the rotation matrix R:

8 11/27/2023
Cont..
 Therefore, we can see that the relationship between points before and after
the rotation is:

9 11/27/2023
3. 2-D Scaling
 The scaling transformation multiplies each coordinate of each point by a scale
factor.
 The scale factor can be different for each coordinate (e.g. for the x and y
coordinates).
 If all scale factors are equal, we call it uniform scaling, whereas if they are
different, we call it differential scaling.
 To scale a point P by scale factors Sx and Sy we apply the scaling matrix S:

10 11/27/2023
Example of Scaling
 Given (2,3) ,(1,1),(3,1) and Scaling Factor Sx,Sy)=(2,2)
 p’x=Sx*px=2*2=4
 P’y=Sy*Py=3*2=6
 p’x=Sx*px=1*2=2
 P’y=Sy*Py=1*2=2
 p’x=Sx*px=3*2=6
 P’y=Sy*Py=1*2=2
 Therefore
 (4,6) ,(2,2),(6,2)

11 11/27/2023
Homogeneous Coordinates
 To express any two-dimensional transformation as a matrix multiplication, we
represent each Cartesian coordinate position (x, y) with the homogeneous
coordinate triple (xh, yh, h), where:
 Coordinates are represented with three-element row vectors, and
transformation operations are written as 3 by 3 matrices
 For translation, we have:
exactly the same as before,
Therefore but we used a matrix
p′x = px + t x
, multiplication instead of an
p′y = p y + t y addition.

12 11/27/2023
Cont.…
 Similarly, rotation transformation equations about the coordinate origin are
now written as:
y ′ 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠 0
 x ′ , , 1 = [x, y, 1] − 𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 0 =
0 0 1

Therefore p′x = px cosθ − p y sin θ and p′y = p y cosθ + p y sin θ , which is the same outcome as before.

13 11/27/2023
Cont..
 A scaling transformation relative to the coordinate origin is now expressed as
the matrix multiplication
𝑠𝑠𝑥𝑥 0 0
 x ′ , y ′ , 1 = [x, y, 1] 0 𝑠𝑠𝑦𝑦 0 =
0 0 1
 x S 0 0 
 
S = 0 Sy 0
0 1 
 0
 p′x   S x 0 0  px 
    
 p′y  =  0 Sy 0  p y 
1 0 1  1 
   0

14 11/27/2023
Examples
 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.
 Solution:
1 0 0
 Tx = 10, Ty = 5 => 𝑀𝑀𝑇𝑇𝑇𝑇 = 0 1 0
10 5 1

1 0 0
 P1 = (10, 15)=> 10 15 1 0 1 0 = 20 20 1 => 𝑃𝑃1′ = (20 20 )
10 5 1

1 0 0
 P2 = (15, 15)=> 15 15 1 0 1 0 = 25 20 1 => 𝑃𝑃2′ = (25 20 )
10 5 1

15 11/27/2023
Cont...
1 0 0
 P3 = (15, 20)=> 15 20 1 0 1 0 = 25 25 1 => 𝑃𝑃3′ = (25 25 )
10 5 1

1 0 0
 P4 = (10, 20)=> 10 20 1 0 1 0 = 20 25 1 => 𝑃𝑃4′ = (20 25 )
10 5 1

16 11/27/2023
4. Reflection
 Reflection
 A reflection is a transformation that produces a mirror image of an object.
 The mirror image for a two-dimensional reflection is generated relative to an axis of
reflection by rotating the object 1800 about the reflection axis.
 We can choose an axis of reflection in the xy plane or perpendicular to the xy plane.
 When the reflection axis is a line in the xy plane, the rotation path about this axis is in a plane
perpendicular to the xy plane.
 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:

17 11/27/2023
5.2 3-D Transformation
1. Translation
 It is the movement of an object from one position to another
position.
 Translation is done using translation vectors.
 There are three vectors in 3D instead of two.
 These vectors are in x, y, and z directions.
 Translation in the x-direction is represented using Tx.
 The translation is y-direction is represented using Ty.
 The translation in the z- direction is represented using Tz.
18 11/27/2023
Cont..
 If P is a point having co-ordinates in three directions (x, y, z) is translated, then
after translation its coordinates will be (x1 y1 z1) after translation.
 Tx Ty Tz are translation vectors in x, y, and z directions respectively.
• Three-dimensional
transformations are performed
by transforming each vertex of
the object.
• If an object has five corners,
then the translation will be
accomplished by translating all
five points to new locations.
19 11/27/2023
20 11/27/2023
Matrix Translation

21 11/27/2023
Example 2
 Problem-
 Given a 3D object with coordinate points A(0, 3, 1), B(3, 3, 2), C(3, 0, 0), D(0,
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.

 Solution-
 Given-
 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)

22 11/27/2023
Cont..
 For Coordinates A(0, 3, 1)
 Let the new coordinates of A = (Xnew, Ynew, Znew).
 Applying the translation equations, we have-
 Xnew = Xold + Tx = 0 + 1 = 1
 Ynew = Yold + Ty = 3 + 1 = 4
 Znew = Zold + Tz = 1 + 2 = 3
 Thus, New coordinates of A = (1, 4, 3).

23 11/27/2023
Cont..
 For Coordinates B(3, 3, 2)
 Let the new coordinates of B = (Xnew,Ynew, Znew).
 Applying the translation equations, we have-

 Xnew = Xold + Tx = 3 + 1 = 4
 Ynew = Yold + Ty = 3 + 1 = 4
 Znew = Zold + Tz = 2 + 2 = 4

 Thus, New coordinates of B = (4, 4, 4).

24 11/27/2023
Cont…
For Coordinates C(3, 0, 0)
 Let the new coordinates of C = (Xnew, Ynew, Znew).

 Applying the translation equations, we have-
 Xnew = Xold + Tx = 3 + 1 = 4
 Ynew = Yold + Ty = 0 + 1 = 1
 Znew = Zold + Tz = 0 + 2 = 2
 Thus, New coordinates of C = (4, 1, 2).

25 11/27/2023
Cont..
 For Coordinates D(0, 0, 0)
 Let the new coordinates of D = (Xnew, Ynew, Znew).
 Applying the translation equations, we have-
 Xnew = Xold + Tx = 0 + 1 = 1
 Ynew = Yold + Ty = 0 + 1 = 1
 Znew = Zold + Tz = 0 + 2 = 2

 Thus, New coordinates of D = (1, 1, 2).

26 11/27/2023
Cont..
 Example: A point has coordinates in
the x, y, z direction i.e., (5, 6, 7).
 The translation is done in the x-
direction by 3 coordinate and y
direction.
 Three coordinates and in the z-
direction by two coordinates.
 Shift the object. Find coordinates of
the new position.

27 11/27/2023
Cont..

28 11/27/2023
2. Scaling
 Scaling is used to change the size of an object.
 The size can be increased or decreased.
 The scaling three factors are required Sx Sy and Sz.]

 Sx= Scaling factor in x- direction


Sy= Scaling factor in y-direction
Sz= Scaling factor in z-direction

29 11/27/2023
Cont..
• steps performed when scaling of
objects with fixed point (a, b, c).

1. Translate fixed point to the origin


2. Scale the object relative to the origin
3. Translate object back to its original
position.

30 11/27/2023
Cont..
 Note: If all scaling factors Sx=Sy=Sz.Then scaling is
called as uniform Scaling.
 If scaling is done with different scaling vectors, it is called a
differential scaling.

31 11/27/2023
Example
 Problem-01:
 Given a 3D object with coordinate points A(0, 3, 3), B(3, 3, 6), C(3, 0, 1), D(0,
0, 0).
 Apply the scaling parameter 2 towards X axis, 3 towards Y axis and 3 towards
Z axis and obtain the new coordinates of the object.
 Solution-
 Given-
 Old coordinates of the object = A (0, 3, 3), B(3, 3, 6), C(3, 0, 1), D(0, 0, 0)
 Scaling factor along X axis = 2
 Scaling factor along Y axis = 3
 Scaling factor along Z axis =3

32 11/27/2023
Cont..
 Solution For Coordinates A(0, 3, 3)
 Let the new coordinates of A after scaling = (Xnew,Ynew, Znew).
 Applying the scaling equations, we have-
 Xnew = Xold x Sx = 0 x 2 = 0
 Ynew = Yold x Sy = 3 x 3 = 9
 Znew = Zold x Sz = 3 x 3 = 9
 Thus, New coordinates of corner A after scaling = (0, 9, 9).

33 11/27/2023
Cont..
 For Coordinates B(3, 3, 6)
 Let the new coordinates of B after scaling = (Xnew, Ynew, Znew).
 Applying the scaling equations, we have-
 Xnew = Xold x Sx = 3 x 2 = 6
 Ynew = Yold x Sy = 3 x 3 = 9
 Znew = Zold x Sz = 6 x 3 = 18
 Thus, New coordinates of corner B after scaling = (6, 9, 18).

34 11/27/2023
Cont..
 For Coordinates C(3, 0, 1)
 Let the new coordinates of C after scaling = (Xnew, Ynew,
Znew).
 Applying the scaling equations, we have-
 Xnew = Xold x Sx = 3 x 2 = 6
 Ynew = Yold x Sy = 0 x 3 = 0
 Znew = Zold x Sz = 1 x 3 = 3
 Thus, New coordinates of corner C after scaling = (6, 0, 3).

 35 11/27/2023
Cont..
 For Coordinates D(0, 0, 0)
 Let the new coordinates of D after scaling = (Xnew,Ynew, Znew).
 Applying the scaling equations, we have-

 Xnew = Xold x Sx = 0 x 2 = 0
 Ynew = Yold x Sy = 0 x 3 = 0
 Znew = Zold x Sz = 0 x 3 = 0
 Thus, New coordinates of corner D after scaling = (0, 0, 0).

36 11/27/2023
Rotation
 It is moving of an object about an angle.
 Movement can be anticlockwise or clockwise.
 3D rotation is complex as compared to the 2D rotation.
 For 2D we describe the angle of rotation, but for a 3D angle
of rotation and axis of rotation are required.
 There are 3 possible types of rotation-
X-axis Rotation
Y-axis Rotation
Z-axis Rotation

37 11/27/2023
CONT…

38 11/27/2023
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θ

39 11/27/2023
Cont...
 For Z-Axis Rotation-
 This rotation is achieved by using the following rotation equations-
 Xnew = Xold * cosθ – Yold*sinθ
 Ynew = Xold * sinθ + Yold *cosθ
 Znew = Zold

40 11/27/2023
Example
 Problem-01:
 Given a homogeneous point (1, 2, 3). Apply rotation 90 degree towards X,Y
and Z axis and find out the new coordinate points.
 Solution-
 Given-
 Old coordinates = (Xold,Yold, Zold) = (1, 2, 3)
 Rotation angle = θ = 90º

41 11/27/2023
For X-Axis Rotation-
 Let the new coordinates after rotation = (Xnew,Ynew, Znew).
 Applying the rotation equations, we have-
 Xnew = Xold = 1
 Ynew = Yold x cosθ – Zold x sinθ = 2 x cos90° – 3 x sin90° = 2 x 0 – 3 x 1 = -3
 Znew = Yold x sinθ + Zold x cosθ = 2 x sin90° + 3 x cos90° = 2 x 1 + 3 x 0 = 2
 Thus, New coordinates after rotation = (1, -3, 2).

42 11/27/2023
For Y-Axis Rotation-
 Let the new coordinates after rotation = (Xnew,Ynew, Znew).
 Applying the rotation equations, we have-
 Xnew = Zold x sinθ + Xold x cosθ = 3 x sin90° + 1 x cos90° = 3 x 1 + 1 x 0 = 3
 Ynew = Yold = 2
 Znew = Yold x cosθ – Xold x sinθ = 2 x cos90° – 1 x sin90° = 2 x 0 – 1 x 1 = -1

 Thus, New coordinates after rotation = (3, 2, -1).

43 11/27/2023
For Z-Axis Rotation-
 Let the new coordinates after rotation = (Xnew,Ynew, Znew).
 Applying the rotation equations, we have-
 Xnew = Xold x cosθ – Yold x sinθ = 1 x cos90° – 2 x sin90° = 1 x 0 – 2 x 1 =
-2
 Ynew = Xold x sinθ + Yold x cosθ = 1 x sin90° + 2 x cos90° = 1 x 1 + 2 x 0 =
1
 Znew = Zold = 3

 Thus, New coordinates after rotation = (-2, 1, 3)

44 11/27/2023
Combination of Transformations
 A number of transformations or sequence of transformations
can be combined into single one called as composition.
 The resulting matrix is called as composite matrix. The process
of combining is called as concatenation.
 Suppose we want to perform rotation about an arbitrary point,
then we can perform it by the sequence of three transformations
1.Translation
2.Rotation
3.Scaling

45 11/27/2023
Example

46 11/27/2023
End of chapter 4

47 11/27/2023

You might also like