04transformation2d

979 views
926 views

Published on

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
979
On SlideShare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
43
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

04transformation2d

  1. 1. 2D Geometric Transformations 고려대학교 컴퓨터 그래픽스 연구실
  2. 2. Contents <ul><li>Definition & Motivation </li></ul><ul><li>2D Geometric Transformation </li></ul><ul><ul><li>Translation </li></ul></ul><ul><ul><li>Rotation </li></ul></ul><ul><ul><li>Scaling </li></ul></ul><ul><li>Matrix Representation </li></ul><ul><li>Homogeneous Coordinates </li></ul><ul><li>Matrix Composition </li></ul><ul><li>Composite Transformations </li></ul><ul><ul><li>Pivot-Point Rotation </li></ul></ul><ul><ul><li>General Fixed-Point Scaling </li></ul></ul><ul><ul><li>Reflection and Shearing </li></ul></ul><ul><ul><li>Transformations Between Coordinate Systems </li></ul></ul>
  3. 3. Geometric Transformation <ul><li>Definition </li></ul><ul><ul><li>물체의 좌표를 바꾸는 것 </li></ul></ul><ul><ul><li>Translation, Rotation, Scaling </li></ul></ul><ul><li>Motivation – Why do we need geometric transformations in CG? </li></ul><ul><ul><li>As a viewing aid </li></ul></ul><ul><ul><li>As a modeling tool </li></ul></ul><ul><ul><li>As an image manipulation tool </li></ul></ul>
  4. 4. Example: 2D Geometric Transformation Modeling Coordinates World Coordinates
  5. 5. Example: 2D Scaling Modeling Coordinates World Coordinates Scale(0.3, 0.3)
  6. 6. Example: 2D Rotation Modeling Coordinates Scale(0.3, 0.3) Rotate(-90) World Coordinates
  7. 7. Example: 2D Translation Modeling Coordinates Scale(0.3, 0.3) Rotate(-90) Translate(5, 3) World Coordinates
  8. 8. Example: 2D Geometric Transformation Modeling Coordinates World Coordinates Again?
  9. 9. Example: 2D Geometric Transformation Modeling Coordinates World Coordinates Scale Translate Scale Rotate Translate
  10. 10. Basic 2D Transformations <ul><li>Translation </li></ul><ul><li>Scale </li></ul><ul><li>Rotation </li></ul><ul><li>Shear </li></ul>
  11. 11. Basic 2D Transformations <ul><li>Translation </li></ul><ul><li>Scale </li></ul><ul><li>Rotation </li></ul><ul><li>Shear </li></ul>Transformations can be combined (with simple algebra)
  12. 12. Basic 2D Transformations <ul><li>Translation </li></ul><ul><li>Scale </li></ul><ul><li>Rotation </li></ul><ul><li>Shear </li></ul>
  13. 13. Basic 2D Transformations <ul><li>Translation </li></ul><ul><li>Scale </li></ul><ul><li>Rotation </li></ul><ul><li>Shear </li></ul>
  14. 14. Basic 2D Transformations <ul><li>Translation </li></ul><ul><li>Scale </li></ul><ul><li>Rotation </li></ul><ul><li>Shear </li></ul>
  15. 15. Basic 2D Transformations <ul><li>Translation </li></ul><ul><li>Scale </li></ul><ul><li>Rotation </li></ul><ul><li>Shear </li></ul>
  16. 16. Matrix Representation <ul><li>Represent a 2D Transformation by a Matrix </li></ul><ul><li>Apply the Transformation to a Point </li></ul>Transformation Matrix Point
  17. 17. Matrix Representation <ul><li>Transformations can be combined by matrix multiplication </li></ul>Matrices are a convenient and efficient way to represent a sequence of transformations Transformation Matrix
  18. 18. 2×2 Matrices <ul><li>What types of transformations can be represented with a 2×2 matrix? </li></ul><ul><li>2D Identity </li></ul><ul><li>2D Scaling </li></ul>
  19. 19. 2×2 Matrices <ul><li>What types of transformations can be represented with a 2×2 matrix? </li></ul><ul><li>2D Rotation </li></ul><ul><li>2D Shearing </li></ul>
  20. 20. 2×2 Matrices <ul><li>What types of transformations can be represented with a 2×2 matrix? </li></ul><ul><li>2D Mirror over Y axis </li></ul><ul><li>2D Mirror over (0,0) </li></ul>
  21. 21. 2×2 Matrices <ul><li>What types of transformations can be represented with a 2×2 matrix? </li></ul><ul><li>2D Translation </li></ul>NO!! Only linear 2D transformations can be Represented with 2x2 matrix
  22. 22. 2D Translation <ul><li>2D translation can be represented by a 3×3 matrix </li></ul><ul><ul><li>Point represented with homogeneous coordinates </li></ul></ul>
  23. 23. Basic 2D Transformations <ul><li>Basic 2D transformations as 3x3 Matrices </li></ul>Translate Shear Scale Rotate
  24. 24. Homogeneous Coordinates <ul><li>Add a 3rd coordinate to every 2D point </li></ul><ul><ul><li>(x, y, w) represents a point at location (x/w, y/w) </li></ul></ul><ul><ul><li>(x, y, 0) represents a point at infinity </li></ul></ul><ul><ul><li>(0, 0, 0) Is not allowed </li></ul></ul>1 2 1 2 x y (2, 1, 1) or (4, 2, 2) or (6, 3, 3) Convenient Coordinate System to Represent Many Useful Transformations
  25. 25. Linear Transformations <ul><li>Linear transformations are combinations of … </li></ul><ul><ul><li>Scale </li></ul></ul><ul><ul><li>Rotation </li></ul></ul><ul><ul><li>Shear, and </li></ul></ul><ul><ul><li>Mirror </li></ul></ul><ul><li>Properties of linear transformations </li></ul><ul><ul><li>Satisfies: </li></ul></ul><ul><ul><li>Origin maps to origin </li></ul></ul><ul><ul><li>Lines map to lines </li></ul></ul><ul><ul><li>Parallel lines remain parallel </li></ul></ul><ul><ul><li>Ratios are preserved </li></ul></ul><ul><ul><li>Closed under composition </li></ul></ul>
  26. 26. Affine Transformations <ul><li>Affine transformations are combinations of </li></ul><ul><ul><li>Linear transformations, and </li></ul></ul><ul><ul><li>Translations </li></ul></ul><ul><li>Properties of affine transformations </li></ul><ul><ul><li>Origin does not map to origin </li></ul></ul><ul><ul><li>Lines map to lines </li></ul></ul><ul><ul><li>Parallel lines remain parallel </li></ul></ul><ul><ul><li>Ratios are preserved </li></ul></ul><ul><ul><li>Closed under composition </li></ul></ul>
  27. 27. Projective Transformations <ul><li>Projective transformations… </li></ul><ul><ul><li>Affine transformations, and </li></ul></ul><ul><ul><li>Projective warps </li></ul></ul><ul><li>Properties of projective transformations </li></ul><ul><ul><li>Origin does not map to origin </li></ul></ul><ul><ul><li>Lines map to lines </li></ul></ul><ul><ul><li>Parallel lines do not necessarily remain parallel </li></ul></ul><ul><ul><li>Ratios are not preserved </li></ul></ul><ul><ul><li>Closed under composition </li></ul></ul>
  28. 28. Matrix Composition <ul><li>Transformations can be combined by matrix multiplication </li></ul><ul><li>Efficiency with premultiplication </li></ul><ul><ul><li>Matrix multiplication is associative </li></ul></ul>
  29. 29. Matrix Composition <ul><li>Rotate by  around arbitrary point (a,b) </li></ul><ul><li>Scale by sx, sy around arbitrary point (a,b) </li></ul>(a,b) (a,b)
  30. 30. Pivot-Point Rotation Translate Rotate Translate (x r ,y r ) (x r ,y r ) (x r ,y r ) (x r ,y r )
  31. 31. General Fixed-Point Scaling Translate Scale Translate (x f ,y f ) (x f ,y f ) (x f ,y f ) (x f ,y f )
  32. 32. Reflection <ul><li>Reflection with respect to the axis </li></ul><ul><li>• x 축에 대한 반사 • y 축에 대한 반사 • xy 축 ( 원점 ) 에 대한 </li></ul>y 축에 대한 반사 x 축에 대한 반사 원점에 대한 반사 x y 1 3 2 1’ 3’ 2’ x y 1 3 2 1’ 3’ 2 x y 3 1’ 3’ 2 1 2
  33. 33. Reflection <ul><li>Reflection with respect to a Line </li></ul><ul><li>Clockwise rotation of 45  Reflection about the x axis  Counterclockwise rotation of 45 </li></ul>y=x 에 대한 반사 x y 1 3 2 1’ 3’ 2’ x y x y x y
  34. 34. Shear <ul><li>Converted to a parallelogram </li></ul><ul><li> </li></ul><ul><li>x’ = x + sh x · y, y’ = y </li></ul><ul><li>Transformed to a shifted parallelogram </li></ul><ul><ul><li>(Y = Yref) </li></ul></ul><ul><li> </li></ul><ul><li>x’ = x + sh x · ( y-y ref ), y’ = y </li></ul>x 축으로 밀림 ( Sh x =2 ) 선분에 대한 밀림 ( Sh x =1/2, y ref =-1 ) (0,0) (1,0) (1,1) (0,1) ( 0,0 ) ( 1,0 ) ( 1,1 ) (0,1) (0,0) (1,0) (3,1) (2,1) ( 1/2,0 ) ( 3/2,0 ) ( 2,1 ) ( 1,1 ) (0,-1) x y x y x y x y
  35. 35. Shear <ul><li>Transformed to a shifted parallelogram </li></ul><ul><ul><li>(X = Xref) </li></ul></ul><ul><li>x’ = x, y’ = sh y · ( x-x ref ) + y </li></ul>선분에 대한 밀림 ( Sh y =1/2, x ref =-1 ) x y (-1,0) ( 0,0 ) ( 1,0 ) ( 1,1 ) ( 0,1 ) ( 0,1/2 ) ( 1,1 ) ( 1,2 ) ( 0,3/2 ) x y

×