Download presentation

1
**Geometric Transformations**

Basic 2D geometric transformation Homogeneous coordinates 2D transformations Translation Scaling Rotation Composite transformations Other transformation: Shearing, Reflection 3D transformations Other 3D transformation: Shearing, Reflection OpenGL Matrix stack Lecture 7 Transformation

2
**1. Basic 2D Transformation**

2D Translation A translation moves a vertex to a new position by adding a displacement vector to it. Eg, The following translates the vertex to by adding (3,13) (7,7) Lecture 7 Transformation

3
**2D Rotation r (x’,y’) (x,y) x=r cos y=r sin x’ = r cos(+)**

= r cos cos r sin sin = x cos - y sin y’ = r sin(+) = r sin cos + r cos sin = x sin + y cos y=r sin Lecture 7 Transformation

4
**2D Scaling x’ = x sx y’ = y sy (x, y) (x’, y’)**

Lecture 7 Transformation

5
**2. Linear Transformations on vertices**

A linear transformation moves a vertex to a new position by multiplying it with a non-singular matrix. Eg, The following transforms the vertex (2, 3) to (3, 13) (3,13) (2,3) Lecture 7 Transformation

6
**Affine Transformations on vertices**

An affine transformation is a linear transformation followed by a translation. Its 2D general form is Affine transformations preserve lines. Many geometric movements of objects, eg, translations, rotations, and scalings are affine transformations. Lecture 7 Transformation

7
**3. Homogeneous coordinates**

A point in homogeneous coordinates (x, y, w), w ≠ 0, corresponds to the 2-D vertex (x/w, y/w) in Cartesian coordinates Conceive that the Cartesian coordinates axes lies on the plane of w = 1. The intersection of the plane and the line connecting the origin and (x, y, w) gives the corresponding Cartesian coordinates w (x, y, w) w = 1 (x/w, y/w, 1) x y y x w = 0 Lecture 7 Transformation

8
E.g. both the points (6, 9, 3) and (4, 6, 2) in the homogeneous coordinates corresponds to (2, 3) in the Cartesian coordinates. Conversely, the point (2, 1) of the Cartesian corresponds to (2, 1, 1), (4, 2, 2) or (6, 3, 3) of the homogeneous w 6, 3, 3) (4, 2, 2) w = 1 (2, 1, 1) x y y x w = 0 Lecture 7 Transformation

9
**Homogeneous coordinates of vectors**

A 2-D vector (x, y) of Cartesian corresponds to (x, y, 0) in homogeneous coordinates and vice versa. Note that vectors and vertices have different representations in homogeneous coordinates. On the other hand, the transformation formulas for both vectors and vertices in homogeneous coordinates are identical. Such generalization enhances simplicity, and thus the reliability, of a graphics system Lecture 7 Transformation

10
**4. 2D Transformation in Homogeneous form**

2D Translation in Homogeneous form (1,1) (5,1) (1,3) (x,y) (3,2) (7,2) (3,4) (x’, y’) Lecture 7 Transformation

11
**2D Rotation in Homogeneous form**

Lecture 7 Transformation

12
**Eg, to rotate 45o (/4 radian) sin /4 = cos /4 = 0.7071**

(1,1) (5,1) (1,3) (x,y) (0,1.4) (2.8, 4.2) (-1.4, 2.8) (x’, y’) Lecture 7 Transformation

13
**2D Translation in Homogeneous**

(1,1) (5,1) (1,3) (x,y) (2,1/2) (10,1/2) (2,3/2) (x’, y’) Lecture 7 Transformation

14
**5. Composite a sequence of transformations**

Translate the right-angle vertex to the origin (Tx = -1, Ty = -1) Rotate 45o (/4 radian) sin /4 = cos /4 = (1,1) (5,1) (1,3) (0,0) (4,0) (0,2) (2.8,2.8) (-1.4,1.4) Lecture 7 Transformation

15
**Lecture 7 Transformation**

16
**6. Composite Transformation Implementation **

All practical transformations on vertices and vectors in homogeneous coordinates can be expressed as pure matrix multiplications. Such uniformity greatly enhance the run-time efficiency of a graphics system. Suppose that a set of 1 million vertices needs to go through three transformations representing by the matrices M1, M2, and M3. A straightforward formula of the overall transformations for a vertex v is v´ = M3*M2*M1*v. As matrix multiplication is associative, we can compute M = M3*M2*M1 in advance, then transform all 1 million vertices using the formula v´ = M*v. Lecture 7 Transformation

17
**7. Other 2D Transformation**

Shearing Uneven scaling and shearing change the shape of an object An example of 2D shearing in x direction (To alter x-coordinates by an amount proportional to the y value.) y x (0,0) (0,1) (1,0) (1,1) (2,1) (3,1) x’ = x + 2y y’ = y Lecture 7 Transformation

18
**x’ = x y’ = 2x + y y x y x (0,0) (0,1) (1,2) (1,3) (0,0) (0,1) (1,0)**

(1,1) x’ = x y’ = 2x + y Lecture 7 Transformation

19
**(x,y) (x,-y) Reflection about the x axis Reflection about the y axis ?**

Reflection w.p.t the origin ? Reflection w.p.t the x = y Lecture 7 Transformation

20
**y =mx+b Reflection along a line**

Translate (0, -b) so that the line passes through the origin Rotate the line onto the x axis by -o Reflect about the x axis Backward rotate backward translate (Be reminded that these operations must be specified in reverse order.) b Lecture 7 Transformation

Similar presentations

OK

1 Teaching Innovation - Entrepreneurial - Global The Centre for Technology enabled Teaching & Learning, N Y S S, India DTEL DTEL (Department for Technology.

1 Teaching Innovation - Entrepreneurial - Global The Centre for Technology enabled Teaching & Learning, N Y S S, India DTEL DTEL (Department for Technology.

© 2018 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on polynomials Ppt on mumbai as the financial capital of india Ppt on hotel industry in india 2012 Ppt on eddy current Ppt on monitoring and evaluation Free ppt on teachers day Ppt on plasma arc machining Ppt on resistance temperature detector application Download ppt on civil disobedience movements Run ppt on html website