Presentation is loading. Please wait.

Presentation is loading. Please wait.

2003CS Hons RW778 Graphics1 Chapter 5: Transforming Objects 5.2 Introduction to Transformations 5.2 Introduction to Transformations –Affine transformations.

Similar presentations


Presentation on theme: "2003CS Hons RW778 Graphics1 Chapter 5: Transforming Objects 5.2 Introduction to Transformations 5.2 Introduction to Transformations –Affine transformations."— Presentation transcript:

1 2003CS Hons RW778 Graphics1 Chapter 5: Transforming Objects 5.2 Introduction to Transformations 5.2 Introduction to Transformations –Affine transformations are useful: »Compose scene from instances »Exploit and repeat symmetries »Different viewpoints of same scene (move camera) »Computer animation –Graphics pipeline and current transformation (CT) –Object transformation vs coordinate transformation

2 2003CS Hons RW778 Graphics2 Chapter 5: Transforming Objects 5.2.1 Transforming Points and Objects 5.2.1 Transforming Points and Objects –Map point P to image Q –Most mappings continuous –Restrict ourselves to affine (linear) transformations. 5.2.2 The Affine Transformations 5.2.2 The Affine Transformations –and similarly for vectors.

3 2003CS Hons RW778 Graphics3 Chapter 5: Transforming Objects 5.2.3 Geometric Effects of Elementary 2D Affine Transformations 5.2.3 Geometric Effects of Elementary 2D Affine Transformations –Combinations of : Translation, scaling, rotation, shear. –Translation: »Or, Q = P + d –Scaling: »scaling about the origin »negative: reflection »uniform vs differential scaling

4 2003CS Hons RW778 Graphics4 Chapter 5: Transforming Objects –Rotation: CCW –Shearing:

5 2003CS Hons RW778 Graphics5 Chapter 5: Transforming Objects 5.2.4 Inverse of an Affine Transformation 5.2.4 Inverse of an Affine Transformation –Most affine transformations are nonsingular (ie det(M) is nonzero) –To undo transformation Q = MP, use P = M -1 Q. –Scaling: –Rotation: –Shearing: –Translation:

6 2003CS Hons RW778 Graphics6 Chapter 5: Transforming Objects 5.2.5 Composing Affine Transformations 5.2.5 Composing Affine Transformations –For homogeneous coordinates: Affine transformations composed by matrix multiplication in reverse order. 5.2.6 Examples: Composing 2D Transformations 5.2.6 Examples: Composing 2D Transformations –Rotate about an arbitrary point: translate, rotate, translate –Reflections about a tilted line

7 2003CS Hons RW778 Graphics7 Chapter 5: Transforming Objects 5.2.7 Useful Properties of Affine Transformations 5.2.7 Useful Properties of Affine Transformations –AT preserve affine combinations of points T(a 1 P 1 +a 2 P 2 ) = a 1 T(P 1 ) + a 2 T(P 2 ) –AT preserve lines and planes: If L(t)=(1-t)A+tB, then Q(t) = (1-t)T(A) + tT(B) –Parallelism of lines and planes is preserved: Given A+bt, we have M(A+bt)=MA + (Mb)t. Independent of A, with same direction b. –Columns of matrix reveal transformed coordinate frame »m 1 =Mi, m 2 =Mj »Frame (i,j, ) transforms into frame (m 1,m 2,m 3 )

8 2003CS Hons RW778 Graphics8 Chapter 5: Transforming Objects –Relative ratios are preserved: –Effects of transformations on areas: |det M| = –Every AT is composed of elementary operations: »2D:any M can be written as (translation)(shear)(scale)(rotation) »3D:any M as (transl)(scale)(rotation)(shear1)(shear2)

9 2003CS Hons RW778 Graphics9 Chapter 5: Transforming Objects 5.3 3D Affine Transformations 5.3 3D Affine Transformations –5.3.1 Elementary 3D Transformations »As for 2D. Selfstudy pp. 234-238. Note rotations: x-roll, y-roll, z-roll. –5.3.2 Composing 3D Affine Transformations »As for 2D. Selfstudy p. 238. –5.3.3 Combining rotations »3D rotation matrices do not commute! »M = R z (ß 3 )R y (ß 2 )R x (ß 1 ) : Euler’s angles

10 2003CS Hons RW778 Graphics10 Chapter 5: Transforming Objects –Rotations about arbitrary axis: »Any rotation about a point is equivalent to a single rotation about some axis through the point (Euler’s theorem). »R u (ß) = R y (-  )R z (  )R x (ß)R z (  )R y (  ) »OpenGL: glRotated (angle, ux, uy, uz)

11 2003CS Hons RW778 Graphics11 Chapter 5: Transforming Objects –Finding axis and angle of rotation: Read. 5.4 Changing Coordinate Systems 5.4 Changing Coordinate Systems –(a,b,1) T = M(c,d,1) T –Successive changes in coordinate frame: (a,b,1) T = M 1 (c,d,1) T = M 1 M 2 (e,f,1) T –Note: to transform points, premultiply. To transform coordinate system, postmultiply. –OpenGL: postmultiply by default.

12 2003CS Hons RW778 Graphics12 Chapter 5: Transforming Objects –Finding axis and angle of rotation: Read. 5.5 Affine Transformations in a Program 5.5 Affine Transformations in a ProgramSelfstudy. 5.6 Drawing 3D Scenes with OpenGL 5.6 Drawing 3D Scenes with OpenGL Selfstudy. Note : modelview matrix, projection matrix, viewport matrix.

13 2003CS Hons RW778 Graphics13 Chapter 5: Transforming Objects Homework Task 4 : Homework Task 4 : 1.Practice Exercise 5.2.6, p. 223. 2.Practice Exercise 5.2.21, pp. 228. 3.Practice Exercise 5.3.9, p. 243. 4.Practice Exercise 5.5.3, p. 258. 5.Practice Exercise 5.6.1, p. 264. 6.Practice Exercise 5.8.10, p. 283.


Download ppt "2003CS Hons RW778 Graphics1 Chapter 5: Transforming Objects 5.2 Introduction to Transformations 5.2 Introduction to Transformations –Affine transformations."

Similar presentations


Ads by Google