1 / 12

2D Transformations, Homogeneous Coordinates, Change in Coordinates

2D Transformations, Homogeneous Coordinates, Change in Coordinates. Soon Tee Teoh CS 116A. Composite Transformations. What if we want to translate, then rotate about y axis, then translate again, then rotate about x axis …?

yelena
Download Presentation

2D Transformations, Homogeneous Coordinates, Change in Coordinates

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 Transformations, Homogeneous Coordinates, Change in Coordinates Soon Tee Teoh CS 116A

  2. Composite Transformations • What if we want to translate, then rotate about y axis, then translate again, then rotate about x axis …? • It would be tedious to perform repeated transformation for every vertex. • Need a better way to represent composite transformation.

  3. Matrix representation of transformation • We saw last time: Scaling Rotation cos q - sin q sin q cos q sx 0 0 sy R = S =

  4. Composite Transformations • Simply multiply single transformation matrices P’ = TP P’ = T2T1P Let Tc = T2T1 Then, P’ = TcP Matrix identities: A(BC) = (AB)C, but AB not necessarily equal to BA. If you want to perform transformation T1 on P first, and then perform T2, you have to put T1 on the right hand side, as shown above.

  5. Homogeneous Coordinates • What is the translation matrix? • Translation adds rather than multiplies! • Therefore, to accommodate translation, we need: P’ = M1P + M2 where M1 takes care of rotation and scaling, while M2 takes care of translation. This is undesirable!

  6. Homogeneous Coordinates • Solution: Homogeneous coordinates • Represent coordinates as (x,y,h) • Actual coordinates drawn will be (x/h,y/h)

  7. Homogeneous Coordinates • The transformation matrices become 3x3 matrices, and we have a translation matrix! x’ y’ 1 1 0 tx 0 1 ty 0 0 1 x y 1 = New point Transformation Original point Exercise: Try composite translation.

  8. Homogeneous Coordinates • Rotation and Scaling Matrices cos q - sin q 0 sin q cos q 0 0 0 1 sx 0 0 0 sy 0 0 0 1 R = S = Exercise: What is the transformation matrix of rotation by t around pivot point (xp,yp)?

  9. 2D Transformation: Reflection • Reflection about the x axis: Just flip the y coordinate • Reflection about the y axis: Just flip the x coordinate • Reflection about the origin, flip both coordinates Reflection about y axis Reflection about origin Reflection about x axis 1 1 1 1’ 2 3 2 3 2 3 3’ 2’ 3’ 2’ 2’ 3’ 1’ 1’ 1 0 0 0 -1 0 0 0 1 -1 0 0 0 1 0 0 0 1 -1 0 0 0 -1 0 0 0 1

  10. 2D Transformation: Shear • Distorts the shape of the object, as though the object has internal layers that slide. • Example: Shear relative to the x axis; that is, the x axis remains unchanged. • Specify shear factor s. • Then (x’,y’) = (x + sy, y) Example: Shear relative to x axis with shear factor 1: 3 2 1 1 2 3 4

  11. Changing Coordinate System • P is described as (x,y) in the x-y coordinate system. We wish to describe P in the x’-y’ coordinate system. What is (x’,y’)? • First, translate by (x,y) by (-x0,-y0) • Then, rotate by - q y axis y y’ axis P x’ axis y’ x’ q y0 x axis x0 x

  12. Changing Coordinate System y axis y y’ axis P x’ axis y’ x’ q x axis x y axis y axis/ y’ axis y’ axis P y’ P x’ axis y’ x’ q x’ x axis/x’ axis

More Related