1 / 42

Modeling Transformation

Modeling Transformation. Overview. 2D Transformation Basic 2D transformations Matrix representation Matrix Composition 3D Transformation Basic 3D transformations Same as 2D Transformation Hierarchies Scene graphs Ray casting. Modeling Transformation.

cecile
Download Presentation

Modeling Transformation

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. Modeling Transformation

  2. Overview • 2D Transformation • Basic 2D transformations • Matrix representation • Matrix Composition • 3D Transformation • Basic 3D transformations • Same as 2D • Transformation Hierarchies • Scene graphs • Ray casting

  3. Modeling Transformation • Specify transformations for objects • Allow definitions of objects in own coordinate systems • Allow use of object definition multiple times in a scene Ref] Hearn & Baker

  4. 2D Modeling Transformations

  5. 2D Modeling Transformations

  6. Basic 2D Transformations • Translation • x’ = x + tx • y’ = y + ty • Scale • x’ = x * sx • y’ = y * sy • Shear • x’ = x + hx * y • y’ = y + hy * x • Rotation • x’ = x * cosq - y * sinq • y’ = x * sinq + y * cosq

  7. Matrix Representation • Represent 2D transformation by a matrix • Multiply matrix by column vector • Apply transformation to point

  8. Matrix Representation • Transformations combined by multiplication • Matrices are a convenient and efficient way to represent a sequence of transformations

  9. 2 x 2 Matrices • What types of transformations can be represented with a 2 x 2 matrix? • 2D Identity • 2D Scale around (0, 0)

  10. 2 x 2 Matrices • What types of transformations can be represented with a 2x 2 matrix? • 2D Rotate around (0, 0) • 2D Shear shx = 2

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

  12. 2 x 2 Matrices • What types of transformations can be represented with a 2x 2 matrix? • 2D Translation ? NO! Only linear 2D transformation can be presented with a 2 x 2 matrix

  13. Linear Transformations • Linear transformations are combinations of … • Scale • Rotation • Shear • Mirror (=Reflection) • Properties of linear transformations • Satisfies: • Origin maps to origin • Lines map to lines • Parallel line remain parallel • Ratios are preserved • Closed under composition

  14. 2D Translation • 2D Translation represented by a 3 x 3 matrix • Point represented with homogeneous coordinate

  15. 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

  16. Basic 2D Transformations • Basic 2D Transformations as 3 x 3 matrices

  17. Affine Transformations • Affine Transformations are combinations of … • Linear transformation • Translation • Properties of affine transformations • Origin does not necessarily map to origin • Lines map to lines • Parallel line remain parallel • Ratios are preserved • Closed under composition

  18. Transformation : Rigid-Body / Euclidean Transforms • Rigid Body Transformation (=rigid motion) • A transform made up of only translation and rotation • Preserve the shape of the objects that they act on • Preserves distances • Preserves angles Rigid / Euclidean Identity Translation Rotation

  19. Transformation : Similitudes / Similarity Transforms • Similarity Transformations • Preserves angles • Translation, Rotation, Isotropic scaling Similitudes Rigid / Euclidean Identity Translation Isotropic Scaling Rotation

  20. Transformation : Linear Transformations Similitudes Linear Rigid / Euclidean Scaling Identity Translation Isotropic Scaling Reflection Rotation Shear Translation is not linear

  21. Transformation : Affine Transformations • preserves parallel lines Affine Similitudes Linear Rigid / Euclidean Scaling Identity Translation Isotropic Scaling Reflection Rotation Shear

  22. Transformation : Projective Transformations • preserves lines Projective Affine Similitudes Linear Rigid / Euclidean Scaling Identity Translation Isotropic Scaling Reflection Rotation Shear Perspective

  23. Projective Transformations • Projective Transformations … • Affine transformation • Projective warps • Properties of projective transformations • Origin does not necessarily map to origin • Lines map to lines • Parallel line do not necessarily remain parallel • Ratios are not preserved (but “cross-ratios” are) • Closed under composition

  24. Cross-ratio • Given any four points A, B, C, and D, taken in order, define their cross ratio as • Cross Ratio (ABCD) = cross ratio (ABCD) = cross ratio (A'B'C'D')

  25. Matrix Composition • Transformations can be combined by matrix multiplication

  26. Matrix Composition • Matrices are a convenient and efficient way to represent a sequence of transformations • General purpose representations • Hardware matrix multiply • Efficiency with premultiplication

  27. Matrix Composition • Be aware: order of transformations matter • Matrix multiplication is not commutative “Global” “Local”

  28. Non-commutative Composition Scale then Translate: p' = T ( S p ) = TS p (5,3) (2,2) Scale(2,2) Translate(3,1) (1,1) (3,1) (0,0) (0,0) Translate then Scale: p' = S ( T p ) = ST p (8,4) (4,2) Translate(3,1) Scale(2,2) (6,2) (1,1) (3,1) (0,0)

  29. Matrix Composition • Rotate by q around arbitrary point (a, b) • M = T(a, b)* R(q) * T(-a, -b) • Translate (a, b) to the origin • do the rotation about origin • translate back • Scale by sx, sy around arbitrary point (a, b) • M = T(a, b)* S(sx, sy) * T(-a, -b) • Translate (a, b) to the origin • do the scale about origin • translate back

  30. Transformation Game

  31. Overview • 2D Transformation • Basic 2D transformations • Matrix representation • Matrix Composition • 3D Transformation • Basic 3D transformations • Same as 2D • Transformation Hierarchies • Scene graphs • Ray casting

  32. 3D Transformations • Same idea as 2D transformations • Homogeneous coordinates: (x, y, z, w) • 4 x 4 transformation matrices

  33. Basic 3D transformations

  34. Basic 3D transformations

  35. Non-commutative Composition: Order of Rotations • Order of Rotation Affects Final Position • X-axis  Z-axis • Z-axis  X-axis

  36. Matrix Composition : Rotations in space • Rotation about an Arbitrary Axis • Rotate about some arbitrary a through angle • Rotate about the z axis through an angle • The axis a lies in the yz plane • Rotate about the x axis through an angle • The axis a coincident with the z axis • Rotate about the a axis through • Same as a rotation about the now coincident z axis • Reverse the second rotation about the x axis • Reverse the first rotation about the z axis • Returning the axis a to its original position z a y x

  37. Transformation Hierarchies • Scene may have hierarchy of coordinate systems • Each level stores matrix representing transformation from parent’s coordinate system

  38. Transformation Example 1 • Well-suited for humanoid characters

  39. Transformation Example 1 Ref] Princeton University

  40. Transformation Example 2 • An object may appear in a scene multiple times

  41. Transformation Example 2

  42. Summary • Coordinate systems • World coordinates • Modeling coordinates • Representations of 3D modeling transformations • 4 x 4 Matrices • Scale, rotate, translate, shear, projections, etc. • Not arbitrary warps • Composition of 3D transformations • Matrix multiplication (order matters) • Transformation hierarchies

More Related