1 / 52

Review: Transformations

Review: Transformations. Transformations. Modeling transformations build complex models by positioning (transforming) simple components relative to each other Viewing transformations placing virtual camera in the world transformation from world coordinates to camera coordinates

Download Presentation

Review: 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. Review:Transformations CSE 681

  2. Transformations • Modeling transformations • build complex models by positioning (transforming) simple components relative to each other • Viewing transformations • placing virtual camera in the world • transformation from world coordinates to camera coordinates • Perspective projection of 3D coordinates to 2D • Animation • vary transformations over time to create motion CSE 681

  3. Transformations - Modeling CSE 681

  4. Transformations - Viewing CAMERA OBJECT WORLD CSE 681

  5. Modeling Transformations Transform objects/points Transform coordinate system CSE 681

  6. Affine Transformations Transform P = (x, y, z) to Q = (x’, y’, z’) by M. Affine transformation: CSE 681

  7. Translation Translation by (tx, ty, tz): (tx, ty, tz) CSE 681

  8. Scaling Scaling by (sx, sy, sz): Uniform v. non-uniform scaling CSE 681

  9. y r r   x z Rotation Rotation counter-clockwise by angle  around the z-axis: x’ = x cos() – y sin() y’ = x sin() + y cos() z’ = z • Proof: • x = r cos() • y = r sin() • x’ = r cos( + ) = r cos() cos() – r sin() sin() = x cos() – y sin() • y’ = r sin( + ) = r cos() sin() + r sin() cos() = x sin() + y cos() CSE 681

  10. Rotation around x-axis Rotation counter-clockwise by angle  around the x-axis: x’ = x y’ = y cos() – z sin() z’ = y sin() + z cos() z  y x CSE 681

  11. Rotation around y-axis Rotation counter-clockwise by angle  around the y-axis: y’ = y z’ = z cos() – x sin() x’ = z sin() + x cos() Or x’ = x cos() + z sin() y’ = y z’ = – x sin() + z cos() x  z y CSE 681

  12. Matrix Multiplication • Scaling by (sx, sy, sz): • x’ = sx x • y’ = sy y • z’ = sz z Rotation counter-clockwise by angle  around the z-axis: x’ = x cos() – y sin() y’ = x sin() + y cos() z’ = z • Translation by (tx, ty, tz): • x’ = x + tx • y’ = y + ty • z’ = z + tz CSE 681

  13. Homogeneous Coordinates Represent P by (x, y, z, 1) and Q by (x’, y’, z’, 1). (Homogeneous coordinates.) Scaling by (sx, sy, sz): x’ = sx x y’ = sy y z’ = sz z • Translation by (tx, ty, tz): • x’ = x + tx • y’ = y + ty • z’ = z + tz CSE 681

  14. Rotation Matrices Rotation counter-clockwise by angle  around the x-axis: x’ = x y’ = y cos() – z sin() z’ = y sin() + z cos() • Rotation counter-clockwise by angle  around the y-axis: • x’ = x cos() + z sin() • y’ = y • z’ = – x sin() + z cos() • Rotation counter-clockwise by angle  around the z-axis: • x’ = x cos() – y sin() • y’ = x sin() + y cos() • z’ = z CSE 681

  15. Affine Transformation Matrix Affine transformation: x’ = m11 x + m12 y + m13 z + m14 y’ = m21 x + m22 y + m23 z + m24 z’ = m31 x + m32 y + m33 z + m34 Transformation Matrix: CSE 681

  16. y x z Shearing Shear along the x-axis: x’ = x + hy y’ = y z’ = z CSE 681

  17. y x z Reflection Reflection across the x-axis: x’ = (-1) x y’ = y z’ = z Reflection is a special case of scaling! CSE 681

  18. Elementary Transformations • Translation • Rotation • Scaling • Shear What about inverses? CSE 681

  19. Inverse Transformations Translation Scale Rotation Shear CSE 681

  20. Scale by (2, 1, 1) y • Translate by (20, 5, 0) • Rotate by 30° counter-clockwise around the z-axis x z • Translate by (0, -50, 0) Compose Transformations CSE 681

  21. Scale by (2, 1, 1); y • Translate by (20, 5, 0); • Rotate by 30° counter-clockwise around the z-axis; x z • Translate by (0, -50, 0). Translate Rotate Translate Scale Compose Transformation Matrices CSE 681

  22. y x z Compose Transformation Matrices • Scale by (2, 1, 1); • Translate by (20, 5, 0); • Rotate by 30° counter-clockwise around the z-axis; • Translate by (0, -50, 0). CSE 681

  23. y y x x z z Order Matters! Transformations are not necessarily commutative! • Translate by (20, 0, 0). • Rotate by 30. • Rotate by 30. • Translate by (20, 0, 0). CSE 681

  24. Order of Transformation Matrices Apply transformation matrices from right to left. • Translate by (20, 0, 0). • Rotate by 30. • Rotate by 30. • Translate by (20, 0, 0). CSE 681

  25. Which transformations commute? • Translation and translation? • Scaling and scaling? • Rotation and rotation? • Translation and scaling? • Translation and rotation? • Scaling and rotation? CSE 681

  26. Elementary Transformations • Elementary transformations: • Translation; • Rotation; • Scaling; • Shear. Theorem: Every affine transformation can be decomposed into elementary operations. Euler’s Theorem: Every rotation around the origin can be decomposed into a rotation around the x-axis followed by a rotation around the y-axis followed by a rotation around the z-axis. (or a single rotation about an arbitrary axis). CSE 681

  27. Vectors Vector V = (Vx, Vy, Vz). Homogeneous coordinates: (Vx, Vy, Vz, 0). Affine transformation: CSE 681

  28. Vectors Rotation: Scaling: Translation: (Note: No change.) CSE 681

  29. Transform Parametric Line V P(u) u P0 M M M u W Q(u) Q0 CSE 681

  30. Line transformed point on a line = point on transformed line Theorem: Affine transformations transform lines to lines. CSE 681

  31. Affine Transformation of Lines y y x x z z CSE 681

  32. Affine Combinations Q b R a P M M b M Q’ a R’ P’ CSE 681

  33. Affine Combinations Theorem: Affine transformations preserve affine combinations. CSE 681

  34. Properties of Affine Transformations • Affine transformations map lines to lines; • Affine transformations preserve affine combinations; • Affine transformations preserve parallelism; • Affine transformations change volume by | Det(M) |; • Any affine transformation can be decomposed into elementary transformations. • Affine transformations [does/does not] preserve angles? • Affine transformations [does/does not] preserve the intersection of two lines? • Affine transformations [does/does not] preserve distances? CSE 681

  35. Properties of Transformation Matrices First column is how (1,0,0,0) transforms Second column is how (0,1,0,0) transforms Third column is how (0,0,1,0) transforms Matrix holds how coordinate axes transform and how origin transforms CSE 681

  36. Properties of Pure Rotation Matrices Rows (columns) are orthogonal to each other A row dot product any other row = 0 Each row (column) dot product times itself = 1 RT = R-1 CSE 681

  37. Coordinate Frame • Coordinate frame is given by origin  and three mutually orthogonal unit vectors, i, j, k - defined in (x,y,z) space • Mutually orthogonal (dot products): i•j = ?; i•k = ?; j•k = ?. • Unit vectors (dot products): i•i = ?; j•j = ?; k•k = ?. y j  i k x z CSE 681

  38. y x z Orientation Right handed coordinate system: Left handed coordinate system: y (Into page) z x (Out of page) CSE 681

  39. y y j  i k x x z z Orientation Right handed coordinate system: Left handed coordinate system: k j i  Cross product: i x j = ? Cross product: i x j = ? How do you test whether (i,j,k) is left handed or right handed? CSE 681

  40. y j i  x z k Coordinate Transformations Given object data points defined in the (i, j, k, ) coordinate frame, Given the definition of (i, j, k, ) in (x, y, z) coordinates, How do you determine the coordinates of the object data points in the (x, y, z, 0) frame? CSE 681

  41. y x z Coordinate change (Translation) b (x, y, z) a (0,0,0) c Change from (a,b,c,) coordinates to (x,y,z,0) coordinates: • Move (a,b,c, ) to (x,y,z,0) and invert • Move data relative from (0,0,0) out to  position by adding  CSE 681

  42. b (x, y, z) a c Coordinate change (Rotation) x y  z-axis rotation by  (0,0,0) z Change from (a,b,c,) coordinates to (x,y,z,0) coordinates: • Rotate (a,b,c) by  and invert • Rotate data by - CSE 681

  43. y j j i i  x z k k f 1 0 é ù 0 x ê ú f 0 1 0 y ê ú . f 0 ê ú 0 1 z ê ú 0 0 0 1 ë û Object Transformations Given (i,j,k,p) defined in the (x,y,z,0) coordinate frame, Transform points defined in the (i, j, k, )coordinate frame to the (x,y,z,0) coordinate frame. Rotate object to get x to line up with i, then translate to  CSE 681

  44. y j j i i  x z k k Object Transformations Affine transformation matrix: CSE 681

  45. y j i  x z k Coordinate Transformations Given (i,j,k,f) defined in the (x,y,z,0) coordinate frame, Transform points in (i,j,k,0) coordinate frame to (x,y,z, ) coordinate frame. translate by - , then rotate to align i with x – then invert CSE 681

  46. y j i  x z k Coordinate Transformations T = R= CSE 681

  47. y j i  x z k Affine transformation matrix: Coordinate Transformations Apply RT to coordinate system Apply (RT)-1 to data = T-1R-1 CSE 681

  48. Composition of coordinate change y M1 changes from coordinate frame (x,y,z,) to (x’,y’,z’,’). M2 changes from coordinate frame (x’,y’,z’,’) to (x’’,y’’,z’’,’’). Change from coordinate frame (x,y,z,) to (x’’,y’’,z’’,0): ? y’ M1 y”  z M2 x x’ ’ z’ 0 x” z” CSE 681

  49. Composition of transformations - example B’ B y q A x CSE 681

  50. Transformations of normal vectors n n is a unit normal vector to plane . M is an affine transformation matrix. How is n transformed, to keep it perpendicular to the plane, under: • translation? • rotation by ? • uniform scaling by s? • shearing or non-uniform scaling?  CSE 681

More Related