Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.

Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.

**Scribd will begin operating the SlideShare business on December 1, 2020**
As of this date, Scribd will manage your SlideShare account and any content you may have on SlideShare, and Scribd's General Terms of Use and Privacy Policy will apply. If you wish to opt out, please close your SlideShare account. Learn more.

Successfully reported this slideshow.

Like this presentation? Why not share!

- 2d/3D transformations in computer g... by Daroko blog(www.p... 10720 views
- 3d transformation computer graphics by Computer Science ... 34519 views
- OpenGL Transformation by Sandip Jadhav 3615 views
- 3D transformation by Aditya Rawat 5451 views
- CS 354 Transformation, Clipping, an... by Mark Kilgard 4569 views
- Projection Matrices by Syed Zaid Irshad 1183 views

9,951 views

Published on

No Downloads

Total views

9,951

On SlideShare

0

From Embeds

0

Number of Embeds

28

Shares

0

Downloads

294

Comments

8

Likes

6

No embeds

No notes for slide

- 1. 2D transformations andhomogeneous coordinates TARUN GEHLOTS
- 2. Map of the lecture• Transformations in 2D: – vector/matrix notation – example: translation, scaling, rotation• Homogeneous coordinates: – consistent notation – several other good points (later)• Composition of transformations• Transformations for the window system
- 3. Transformations in 2D• In the application model: – a 2D description of an object (vertices) – a transformation to apply• Each vertex is modified: • x’ = f(x,y) • y’ = g(x,y)• Express the modification
- 4. Translations• Each vertex is modified: • x’ = x+tx • y’ = y+ty Before After
- 5. Translations: vector notation• Use vector for the notation: – makes things simpler• A point is a vector: x y• A translation is merely a vector sum: P’ = P + T
- 6. Scaling in 2D• Coordinates multiplied by the scaling factor: • x’ = sx x • y’ = sy y Before After
- 7. Scaling in 2D, matrix notation• Scaling is a matrix multiplication: P’ = SP x sx 0 x y 0 sy y
- 8. Rotating in 2D• New coordinates depend on both x and y • x’ = cos x - sin y • y’ = sin x + cos y Before After
- 9. Rotating in 2D, matrix notation• A rotation is a matrix multiplication: P’=RP x cos sin x y sin cos y
- 10. 2D transformations, summary• Vector-matrix notation simplifies writing: – translation is a vector sum – rotation and scaling are matrix-vector multiplication• I would like a consistent notation: – that expresses all three identically – that expresses combination of these also identically• How to do this?
- 11. Homogeneous coordinates• Introduced in mathematics: – for projections and drawings – used in artillery, architecture – used to be classified material (in the 1850s)• Add a third coordinate, w x• A 2D point is a 3 coordinates vector: y w
- 12. Homogeneous coordinates (2)• Two points are equal if and only if: x’/w’ = x/w and y’/w’= y/w• w=0: points at infinity – useful for projections and curve drawing• Homogenize = divide by w.• Homogenized points: x y 1
- 13. Translations with homogeneousx 1 0 tx x x x w w txy 0 1 ty y y yw 0 0 1 w w w ty x x wt x y y wt y w w
- 14. Scaling with homogeneousx sx 0 0 x x xy 0 sy 0 y w s x w y yw 0 0 1 w w s y w x sx x y sy y w w
- 15. Rotation with homogeneousx cos sin 0 xy sin cos 0 y x x y w cos w sin ww 0 0 1 w y x y w sin w cos w x cos x sin y y sin x cos y w w
- 16. Composition of transformations• To compose transformations, multiply the matrices: – composition of a rotation and a translation: M = RT• all transformations can be expressed as matrices – even transformations that are not translations, rotations and scaling
- 17. Rotation around a point Q• Rotation about a point Q: – translate Q to origin (TQ), – rotate about origin (R ) – translate back to Q (- TQ). P’=(-TQ)R TQ P
- 18. Beware!• Matrix multiplication is not commutative• The order of the transformations is vital – Rotation followed by translation is very different from translation followed by rotation – careful with the order of the matrices!• Small commutativity: – rotation commute with rotation, translation with translation…
- 19. From World to Window• Inside the application: – application model – coordinates related to the model – possibly floating point• On the screen: – pixel coordinates – integer – restricted viewport: umin/umax, vmin/vmax
- 20. From Model to Viewportymaxymin xmin xmax
- 21. From Model to Viewport• Model is (xmin,ymin)-(xmax,ymax)• Viewport is (umin,vmin)-(umax,vmax)• Translate by (-xmin,-ymin)• Scale by ( umax-umin , vmax-vmin ) xmax-xmin ymax-ymin• Translate by (umin,vmin) M = T’ST
- 22. From Model to ViewportPixel Coordinates Model Coordinates u x v M y w w
- 23. Mouse position: inverse problem• Mouse click: coordinates in pixels• We want the equivalent in World Coord – because the user has selected an object – to draw something – for interaction• How can we convert from window coordinates to model coordinates?
- 24. Mouse click: inverse problem • Simply inverse the matrix: 1 1 M (T ST)Model Coordinates Pixels coordinates x u 1 y M v w w
- 25. 2D transformations: conclusion• Simple, consistent matrix notation – using homogeneous coordinates – all transformations expressed as matrices• Used by the window system: – for conversion from model to window – for conversion from window to model• Used by the application: – for modeling transformations

No public clipboards found for this slide

Login to see the comments