transformation
play

Transformation CS 148: Summer 2016 Introduction of Graphics and - PowerPoint PPT Presentation

Transformation CS 148: Summer 2016 Introduction of Graphics and Imaging Zahid Hossain http://www.pling.org.uk/cs/cgv.html Placement of Objects Fisher et al. (2012) 2 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016)


  1. Transformation CS 148: Summer 2016 Introduction of Graphics and Imaging Zahid Hossain http://www.pling.org.uk/cs/cgv.html

  2. Placement of Objects Fisher et al. (2012) 2 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  3. Placement of Objects Oriented Fisher et al. (2012) 3 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  4. Placements of Objects Translated Fisher et al. (2012) 4 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  5. Points and Vectors y p x Origin z 5 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  6. Points and Vectors y x Vector Points Origin z 6 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  7. Transformations What? Just functions acting on points: • Why? • • Viewing: • Convert between coordinates systems • Virtual camera, e.g. perspective projections • Modeling: • Create objects in a convenient orientation • Use multiple instances of a given shape • Kinematics – characters/robots 7

  8. Linear Transformation 8 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  9. Linear Transformation 9 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  10. Linear Transformation 10 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  11. Linear Transformation Lines Map to Lines 11 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  12. Common Transformation Rotate Scale Shear 12

  13. 13

  14. Composing Transformations First Rotate 45° 14 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  15. Composing Transformations Then Scale 2x along y 15 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  16. Composing Transformations Scale Rotation Order of transformations 16 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  17. Composing Transformation Not Commutative Rotate -> Scale Scale -> Rotate 17 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  18. Translation 18 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  19. Homogenous Coordinates For any non-zero c 19 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  20. Homogenous Coordinates 20 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  21. Homogenous Coordinates 21 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  22. Homogenous Coordinates 4D Homogenous Coordinate 3D Cartesian Coordinate 22 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  23. Homogenous Coordinates (x,y,w) w-axis w=1 (x/w,y/w,1) x,y-axis 23 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  24. Homogenous Coordinates z-axis Decrease w z=1 x,y-axis 24 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  25. Homogenous Coordinates z-axis Decrease w z=1 x,y-axis 25 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  26. Homogenous Coordinates 26 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  27. Homogenous Coordinates Represents a Vector! (Homogenous Coordinates express both Vectors and Points) 27 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  28. Back to Translation Homogenous Coordinate Homogenous Coordinate 28 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  29. Some Exercise Convert 3D Cartesian Coordinate to Homogenous Coordinate (3,4,2) : 29 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  30. Some Exercise Convert 3D Cartesian Coordinate to Homogenous Coordinate (3,4,2) : (3,4,2,1) 30 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  31. Some Exercise Convert 3D Cartesian Coordinate to Homogenous Coordinate (3,4,2) : (3,4,2,1) Convert Homogenous Coordinate to Cartesian Coordinate (3,4,2,2) : 31 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  32. Some Exercise Convert 3D Cartesian Coordinate to Homogenous Coordinate (3,4,2) : (3,4,2,1) Convert Homogenous Coordinate to Cartesian Coordinate (3,4,2,2) : (1.5,2,1) 32 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  33. Some Exercise Rotate about the center of the box 33 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  34. Some Exercise Translate to center 34 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  35. Some Exercise Rotate 35 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  36. Some Exercise Translate back 36 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  37. Coordinate System 37 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  38. Coordinate System 38 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  39. Coordinate System 39 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  40. Coordinate System: Rotation 40 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  41. Coordinate System: Rotation 41 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  42. Coordinate System: Rotation 42 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  43. Coordinate System: Hierarchy 43 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  44. Coordinate System: Hierarchy 44 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  45. Coordinate System: Hierarchy 45 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  46. Interpreting Transformations 46 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  47. Two Interpretations • With respect to Global Frame • With respect to Local Frame 47 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  48. Coordinate System: Hierarchy 48 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  49. w.r.t Global Frame Rotate(45°) Translate(0,1) Translate(1,1) Combined = Translate(0,1) Rotate(45°) Translate(1,1) Order of Transforms 49 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  50. w.r.t Local Frame Rotate(45°) Translate(1,1) Translate(0,1) Combined = Translate(0,1) Rotate(45°) Translate(1,1) Order of Transform 50 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  51. w.r.t Local Frame Rotate(45°) Translate(1,1) Translate(0,1) Combined = Translate(0,1) Rotate(45°) Translate(1,1) Order of Transform Both interpretations are equivalent 51 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  52. Hierarchical Modeling translate(0,4) drawTorso() pushMatrix() translate(1.5,0) rotateX(leftHipRotate) drawThigh() pushMatrix() translate(0,-2) rotateX(leftKneeRotate) drawLeg() ... popMatrix() popMatrix() pushMatrix() y translate(-1.5,0) rotateX(rightHipRotate) // Draw the right side x Matrix Stack ... ... CurrentMatrix = Translate(0,4) 52 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  53. Hierarchical Modeling translate(0,4) drawTorso() pushMatrix() translate(1.5,0) rotateX(leftHipRotate) drawThigh() pushMatrix() translate(0,-2) rotateX(leftKneeRotate) drawLeg() ... popMatrix() popMatrix() pushMatrix() y translate(-1.5,0) rotateX(rightHipRotate) Translate(0,4) // Draw the right side x Matrix Stack ... ... CurrentMatrix = Translate(0,4) 53 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  54. Hierarchical Modeling translate(0,4) drawTorso() pushMatrix() translate(1.5,0) rotateX(leftHipRotate) drawThigh() pushMatrix() translate(0,-2) rotateX(leftKneeRotate) drawLeg() ... popMatrix() popMatrix() pushMatrix() y translate(0,4) translate(1.5,0) rotateX(leftHipRotate) translate(-1.5,0) rotateX(rightHipRotate) translate(0,4) // Draw the right side x Matrix Stack ... ... CurrentMatrix = translate(0,4) translate(1.5,0) rotateX(leftHipRotate) translate(0,-2) rotate(leftKneeRotate) 54 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

Recommend


More recommend