Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 7 Geometric Transformations (Continued)

Similar presentations


Presentation on theme: "Lecture 7 Geometric Transformations (Continued)"— Presentation transcript:

1 Lecture 7 Geometric Transformations (Continued)
Computer Graphics Lecture 7 Geometric Transformations (Continued)

2 Some examples of translation, rotation and scaling
Suppose a 2-D point is translated by an amount tx in x-direction and ty in y-direction. Then the matrix used to represent this is: T = tx x ty . y

3 For scaling the matrix is given as:
S = sx x 0 sy 0 . y

4 Example 1 Using the matrix, translate the point (2, 6) by 4 in x-direction and -3 in y-direction. T = tx x ty . Y T = = 3 3X3 . 3X1 = 3X1

5 That is, (2, 6) = (6, 3, 1) = (6, 3) (2, 6) 5 4 (6, 3) 2 1

6 Example 2 Using a 2-D transformation matrix rotate the point (2, 6) by 90 degrees anti-clockwise about (0,0). Rθ = cosθ -sinθ 0 sinθ cosθ 0 θ = 90 R90 = = 2 = (2, 6) = (-6, 2)

7

8 Example 3 A triangle is defined by points a(2, 6), b(2,10) and c(6, 8). Firstly translate the triangle by 4 in x-direction and -3 in y-direction and then rotate it anti-clockwise by 90 degrees about (0,0). T = tx ty =

9 Rθ = cosθ -sinθ 0 sinθ cosθ 0 θ = 90 R90 = 1 0 0 0 0 1 a = b = c = 6

10 = = = = = =

11 = = = a(2, 6) = a’(-3, 6) = b(2, 10) = b’(-7, 6) = c(6,8) = c’(-5, 10)

12

13 Example 4 Scale the line joining the points (2, 6) and (6, 8) by 2 in the x-direction and 0.5 in the y-direction. S = sx 0 sy 0 = = 3 = = 4

14

15 Reflection It is a transformation that produces a mirror image of an object. It is generated relative to an axis of reflection by rotating the object 180 degrees about the reflection axis. Reflection about x-axis y = 0 and the matrix is given as It keeps x-values same but flips y values of coordinate positions.

16 It moves out of the xy-plane and rotates 180 degrees about the x-axis and back into the xy-plane on the other side of x-axis

17 2. Reflection about y-axis x = 0 and the matrix is gives as It keeps y-values same but flips x-values.

18

19 Reflect the point (2, 6) in x-axis.
= -6 (2, 6) = (2, -6)

20

21 The points of a triangle are given as (2, 3), (4,3) and (4,6)
The points of a triangle are given as (2, 3), (4,3) and (4,6). Reflect the triangle around y-axis. = =

22 = 6 (2,3) = (-2,3) (4,6) = (-4,6) (4,3) = (-4,3)

23


Download ppt "Lecture 7 Geometric Transformations (Continued)"

Similar presentations


Ads by Google