comp30019 graphics and interaction transformation
play

COMP30019 Graphics and Interaction Transformation geometry and - PowerPoint PPT Presentation

Introduction Vectors and matrices Translation Rotation Homogeneous coordinates Affine transformations COMP30019 Graphics and Interaction Transformation geometry and homogeneous coordinates Adrian Pearce Department of Computing and


  1. Introduction Vectors and matrices Translation Rotation Homogeneous coordinates Affine transformations COMP30019 Graphics and Interaction Transformation geometry and homogeneous coordinates Adrian Pearce Department of Computing and Information Systems University of Melbourne The University of Melbourne Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionTransformation geometry and homogeneous coordinates

  2. Introduction Vectors and matrices Translation Rotation Homogeneous coordinates Affine transformations Lecture outline Introduction Vectors and matrices Translation Rotation Homogeneous coordinates Affine transformations Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionTransformation geometry and homogeneous coordinates

  3. Introduction Vectors and matrices Translation Rotation Homogeneous coordinates Affine transformations Transformation geometry How are geometric transformations represented conveniently and efficiently? Aim: understand two-dimensional ( 2D ) transformations Reading: ◮ Akenine-Möller Section 4.1 Basic Transforms Section 4.2 Special Matrix Transforms and Operations ◮ Foley Sections 5.3 Homogeneous coordinates and matrix representation of 2D transformations, 5.4 Composition of 2D transformations and 5.6 Efficiency. ◮ Angel Sections 3.2 Three-Dimensional Primatives; 3.3 Coordinate Systems and Frames; 3.7 Affine Transformations; 3.8 Translation, Rotation, and Scaling; 3.9 Trnasofmations in Homogenoeous Coordinates and 3.10 Concatenation of Transformations Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionTransformation geometry and homogeneous coordinates

  4. Introduction Vectors and matrices Translation Rotation Homogeneous coordinates Affine transformations Review of two-dimensional (2D) geometry Points are represented either in absolute position, relative to origin in Cartesian coordinates: ( x , y ) ∈ R 2 or polar coordinates: ( ρ, θ ) . � v x � Vectors represent relative displacement, v = and are v y subject to vector addition, subtraction, scalar product (dot product) or norm (magnitude) operations. Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionTransformation geometry and homogeneous coordinates

  5. Introduction Vectors and matrices Translation Rotation Homogeneous coordinates Affine transformations Curves can be modelled in either explicit functional form: y = F ( x ) or implicit equational form: G ( x , y ) = 0 or parametric form: x = x ( t ) y = y ( t ) e.g. some straight lines are: ◮ y = mx + b (explicit functional form) ◮ ax + by + c = 0 (implicit equational form) ◮ x cos θ + y sin θ = ρ (implicit equational form) ◮ x = x 0 + x 1 p ( t ) , y = y 0 + y 1 p ( t ) (parametric form) Special forms include a line through two points or line segments such as endpoints or parameter bounds. Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionTransformation geometry and homogeneous coordinates

  6. Introduction Vectors and matrices Translation Rotation Homogeneous coordinates Affine transformations Geometric transformations General geometric transformations concern object points rather than transformation of the entire coordinate frame, x ′ = g ( x , y ) , y ′ = h ( x , y ) . More specific geometric transformations involve ◮ translations, where x ′ = x + x t , and y ′ = y + y t and ◮ linear transformations v ′ = Mv (where v ′ is a vector and M is a matrix) such as scaling, shear, rotation, reflection. Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionTransformation geometry and homogeneous coordinates

  7. Introduction Vectors and matrices Translation Rotation Homogeneous coordinates Affine transformations Vector and matrix conventions There are two conventions for vectors and matrices where vectors are written as columns: � x � v = y Matrices multiply on the left: � a � � x � b Mv = c d y � ax + by � = cx + dy Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionTransformation geometry and homogeneous coordinates

  8. Introduction Vectors and matrices Translation Rotation Homogeneous coordinates Affine transformations However, watch out for other forms where vectors are written as rows: � T � x � � v = x y = y Matrices multiply on the right: � � a � b � vM = x y c d � ax + cy � = bx + dy Really, you should understand the concepts, and be able to work with either notation. Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionTransformation geometry and homogeneous coordinates

  9. Introduction Vectors and matrices Translation Rotation Homogeneous coordinates Affine transformations Translation Translation is also known as shifting or displacement, where x ′ = x + x t and y ′ = y + y t . Translation in two-dimensional vector notation (by addition ): � x ′ � � x � � x t � = + y ′ y y t Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionTransformation geometry and homogeneous coordinates

  10. Introduction Vectors and matrices Translation Rotation Homogeneous coordinates Affine transformations Rotation Rotation of an object about the origin Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionTransformation geometry and homogeneous coordinates

  11. Introduction Vectors and matrices Translation Rotation Homogeneous coordinates Affine transformations Rotation as a matrix operation (by multiplication): � cos θ � � x � � x cos θ − y sin θ � − sin θ = sin θ cos θ y x sin θ + y cos θ Convenient, as can combine a number of geometric rotations by multiplication , � x ′ � � cos θ � � x � − sin θ = y ′ sin θ cos θ y Unfortunately translation is different to rotation, therefore can’t treat as multiplication (also true for scaling). This means translations and rotations cannot be combined easily. Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionTransformation geometry and homogeneous coordinates

  12. Introduction Vectors and matrices Translation Rotation Homogeneous coordinates Affine transformations How are rotation matrices derived? ( ) Increasing x   , f ( ) x y , Increasing y q ¢ ¢ ( ) x y , Hint: Consider the point above with polar coordinates ( ρ, θ ) (Rowe Fig 2.1). If rotated by angle φ around the origin, its polar coordinates are ( ρ, θ + φ ) , converting to Cartesian coordinates gives, � ρ cos ( θ + φ ) � ρ sin ( θ + φ ) Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionTransformation geometry and homogeneous coordinates

  13. Introduction Vectors and matrices Translation Rotation Homogeneous coordinates Affine transformations We can expand and re-arrange this in terms of the cosine and sine angle-addition formulas , and the Cartesian coordinates of the original point x = ρ cos φ y = ρ sin φ to obtain a matrix expression for a rotation by angle θ . x ′ = ρ cos ( φ + θ ) = ρ cos φ cos θ − ρ sin φ sin θ y ′ = ρ sin ( φ + θ ) = ρ cos φ sin θ + ρ sin φ cos θ x ′ = ρ cos ( φ + θ ) = ρ cos φ cos θ − ρ sin φ sin θ y ′ = ρ sin ( φ + θ ) = ρ cos φ sin θ + ρ sin φ cos θ x ′ = x cos θ − y sin θ y ′ = x sin θ + y cos θ Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionTransformation geometry and homogeneous coordinates

  14. Introduction Vectors and matrices Translation Rotation Homogeneous coordinates Affine transformations Rigid body transformations Rotation, translation, and reflection preserve distances (rigid motions). That is, if two points are a certain distance apart, they will still be the same distance apart after undergoing one of these transformations (or indeed any combination of them). Mathematically, they are the only transformations with this property of preserving distance. Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionTransformation geometry and homogeneous coordinates

  15. Introduction Vectors and matrices Translation Rotation Homogeneous coordinates Affine transformations Reflection Reflection in a line—gives mirror image Move point to position at equal distance on opposite side of the line. Reflection in the x -axis: x ′ = x y ′ = − y Reflection in the y -axis: x ′ = − x y ′ = y Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionTransformation geometry and homogeneous coordinates

  16. Introduction Vectors and matrices Translation Rotation Homogeneous coordinates Affine transformations Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionTransformation geometry and homogeneous coordinates

  17. Introduction Vectors and matrices Translation Rotation Homogeneous coordinates Affine transformations Reflection in the line y = x : x ′ = y y ′ = x All these can be expressed as matrix operations (details left to you). Reflections in an arbitrary line can be achieved by transforming line (by rotation and translation) to one of the coordinate axes, reflecting in that axis, and transforming back. ◮ Reflection reverses handedness —an object goes to its mirror image. ◮ Rotation and translation preserve handedness—they correspond to motions of rigid (solid) objects. Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionTransformation geometry and homogeneous coordinates

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend