1 / 35

2D Geometric Transformations

2D Geometric Transformations. Contents. Definition & Motivation 2D Geometric Transformation Translation Rotation Scaling Matrix Representation Homogeneous Coordinates Matrix Composition Composite Transformations Pivot-Point Rotation General Fixed-Point Scaling

gabby
Download Presentation

2D Geometric 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. 2D Geometric Transformations

  2. Contents • Definition & Motivation • 2D Geometric Transformation • Translation • Rotation • Scaling • Matrix Representation • Homogeneous Coordinates • Matrix Composition • Composite Transformations • Pivot-Point Rotation • General Fixed-Point Scaling • Reflection and Shearing • Transformations Between Coordinate Systems

  3. Geometric Transformation • Definition • Translation, Rotation, Scaling • Motivation – Why do we need geometric transformations in CG? • As a viewing aid • As a modeling tool • As an image manipulation tool

  4. Example: 2D Geometric Transformation Modeling Coordinates World Coordinates

  5. Example: 2D Scaling Modeling Coordinates Scale(0.3, 0.3) World Coordinates

  6. Example: 2D Rotation Modeling Coordinates Scale(0.3, 0.3) Rotate(-90) World Coordinates

  7. Example: 2D Translation Modeling Coordinates Scale(0.3, 0.3) Rotate(-90) Translate(5, 3) World Coordinates

  8. Example: 2D Geometric Transformation Modeling Coordinates Again? World Coordinates

  9. Example: 2D Geometric Transformation Modeling Coordinates Scale Translate Scale Rotate Translate World Coordinates

  10. Basic 2D Transformations • Translation • Scale • Rotation • Shear

  11. Basic 2D Transformations • Translation • Scale • Rotation • Shear Transformations can be combined (with simple algebra)

  12. Basic 2D Transformations • Translation • Scale • Rotation • Shear

  13. Basic 2D Transformations • Translation • Scale • Rotation • Shear

  14. Basic 2D Transformations • Translation • Scale • Rotation • Shear

  15. Basic 2D Transformations • Translation • Scale • Rotation • Shear

  16. Matrix Representation • Represent a 2D Transformation by a Matrix • Apply the Transformation to a Point Transformation Matrix Point

  17. Matrix Representation • Transformations can be combined by matrix multiplication Transformation Matrix Matrices are a convenient and efficient way to represent a sequence of transformations

  18. 2×2 Matrices • What types of transformations can be represented with a 2×2 matrix? 2D Identity 2D Scaling

  19. 2×2 Matrices • What types of transformations can be represented with a 2×2 matrix? 2D Rotation 2D Shearing

  20. 2×2 Matrices • What types of transformations can be represented with a 2×2 matrix? 2D Mirror over Y axis 2D Mirror over (0,0)

  21. 2×2 Matrices • What types of transformations can be represented with a 2×2 matrix? 2D Translation NO!! Only linear 2D transformations can be Represented with 2x2 matrix

  22. 2D Translation • 2D translation can be represented by a 3×3 matrix • Point represented with homogeneous coordinates

  23. Basic 2D Transformations • Basic 2D transformations as 3x3 Matrices Translate Scale Rotate Shear

  24. Homogeneous Coordinates • Add a 3rd coordinate to every 2D point • (x, y, w) represents a point at location (x/w, y/w) • (x, y, 0) represents a point at infinity • (0, 0, 0) Is not allowed y 2 (2, 1, 1) or (4, 2, 2) or (6, 3, 3) 1 x 1 2 Convenient Coordinate System to Represent Many Useful Transformations

  25. Linear Transformations • Linear transformations are combinations of … • Scale • Rotation • Shear, and • Mirror • Properties of linear transformations • Satisfies: • Origin maps to origin • Lines map to lines • Parallel lines remain parallel • Ratios are preserved • Closed under composition

  26. Affine Transformations • Affine transformations are combinations of • Linear transformations, and • Translations • Properties of affine transformations • Origin does not map to origin • Lines map to lines • Parallel lines remain parallel • Ratios are preserved • Closed under composition

  27. Projective Transformations • Projective transformations… • Affine transformations, and • Projective warps • Properties of projective transformations • Origin does not map to origin • Lines map to lines • Parallel lines do not necessarily remain parallel • Ratios are not preserved • Closed under composition

  28. Matrix Composition • Transformations can be combined by matrix multiplication • Efficiency with premultiplication • Matrix multiplication is associative

  29. Matrix Composition • Rotate by  around arbitrary point (a,b) • Scale by sx, sy around arbitrary point (a,b) (a,b) (a,b)

  30. (xr,yr) (xr,yr) (xr,yr) (xr,yr) Pivot-Point Rotation Translate Rotate Translate

  31. (xf,yf) (xf,yf) (xf,yf) (xf,yf) General Fixed-Point Scaling Translate Scale Translate

  32. Reflection • Reflection with respect to the axis • x • y • xy y 1 y y 1 1’ 1’ 2 3 2 3 3’ 2 3’ 2 x x x 3 2’ 3’ 1 2 1’ x y xy

  33. y y y y 1 2 3 x x x x 2’ 3’ 1’ Reflection • Reflection with respect to a Line • Clockwise rotation of 45  Reflection about the x axis  Counterclockwise rotation of 45 y=x에 대한 반사

  34. y y y y x x x x Shear • Converted to a parallelogram x’ = x + shx · y, y’ = y • Transformed to a shifted parallelogram (Y = Yref) x’ = x + shx ·(y-yref), y’ = y (1,1) (0,1) (2,1) (3,1) (0,0) (1,0) (0,0) (1,0) (Shx=2) (2,1) (1,1) (1,1) (0,1) (1/2,0) (3/2,0) (0,0) (1,0) (0,-1) (Shx=1/2, yref=-1)

  35. y x Shear • Transformed to a shifted parallelogram (X = Xref) x’ = x, y’ = shy ·(x-xref) + y (1,2) (0,3/2) y (1,1) (0,1) (0,1/2) (1,1) x (0,0) (1,0) (-1,0) (Shy=1/2, xref=-1)

More Related