1 / 27

Transformations

This reading explores the concepts of 2D transformations in computer graphics, focusing on matrix representations, scaling, rotation, shear, reflection, and translation. It also discusses linear transformations and challenges in utilizing matrix multiplication.

mire
Download Presentation

Transformations

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. http://www.ugrad.cs.ubc.ca/~cs314/Vjan2016 University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016 Tamara Munzner Transformations

  2. Readings for Transformations 1-5 • Shirley/Marschner • Ch 6: Transformation Matrices • except 6.1.6, 6.3.1 • Sect 12.2 Scene Graphs • Gortler • Ch 2: Linear, Sec 2.5-2.6 • Ch 3: Affine • Ch 4: Respect • Ch 5: Frames in Graphics, 5.3-5.4

  3. 2D Transformations

  4. Transformations • transforming an object = transforming all its points • transforming a polygon = transforming its vertices

  5. Matrix Representation • represent 2D transformation with matrix • multiply matrix by column vector apply transformation to point • transformations combined by multiplication • matrices are efficient, convenient way to represent sequence of transformations!

  6. Scaling • scaling a coordinate means multiplying each of its components by a scalar • uniform scaling means this scalar is the same for all components:  2

  7. X  2,Y  0.5 Scaling • non-uniform scaling: different scalars per component: • how can we represent this in matrix form?

  8. Scaling • scaling operation: • or, in matrix form: scaling matrix

  9. 2D Rotation • counterclockwise • RHS (x', y') (x, y) x' = x cos() - y sin() y' = x sin() + y cos() 

  10. 2D Rotation From Trig Identities x = r cos (f) y = r sin (f) x' = r cos (f + ) y' = r sin (f + ) Trig Identity… x' = r cos(f) cos() – r sin(f) sin() y' = r sin(f) cos() + r cos(f) sin() Substitute… x' = x cos() - y sin() y' = x sin() + y cos() (x', y') (x, y)  f

  11. 2D Rotation: Another Derivation (x',y') q (x,y)

  12. 2D Rotation: Another Derivation (x',y') q (x,y) y x

  13. 2D Rotation: Another Derivation (x',y') q y x (x,y) q y x

  14. 2D Rotation: Another Derivation (x',y') ' x B (x,y) A

  15. 2D Rotation: Another Derivation (x',y') ' x B x (x,y) q x A

  16. 2D Rotation: Another Derivation (x',y') B ' q x q y (x,y) q q y x A

  17. 2D Rotation Matrix • easy to capture in matrix form: • even though sin(q) and cos(q) are nonlinear functions of q, • x' is a linear combination of x and y • y' is a linear combination of x and y

  18. Shear • shear along x axis • push points to right in proportion to height y y x x

  19. Shear • shear along x axis • push points to right in proportion to height y y x x

  20. Reflection • reflect across x axis • mirror x x

  21. Reflection • reflect across x axis • mirror x x

  22. 2D Translation (x’,y’) (x,y)

  23. 2D Translation (x’,y’) (x,y) scaling matrix rotation matrix

  24. 2D Translation vector addition (x’,y’) (x,y) matrix multiplication matrix multiplication scaling matrix rotation matrix

  25. 2D Translation vector addition (x’,y’) (x,y) matrix multiplication matrix multiplication scaling matrix rotation matrix translation multiplication matrix??

  26. Linear Transformations • linear transformations are combinations of • shear • scale • rotate • reflect • properties of linear transformations • satisifes T(sx+ty) = s T(x) + t T(y) • origin maps to origin • lines map to lines • parallel lines remain parallel • ratios are preserved • closed under composition

  27. Challenge • matrix multiplication • for everything except translation • can we just do everything with multiplication? • then could just do composition, no special cases

More Related