1 / 41

Composing Transformations and Geometric Operations: Understanding 3D Transformations

Explore composing transformations in OpenGL, Shear, Reflection, Homogeneous Coordinates, Normals, and Rotation About Arbitrary Axis. Learn how to perform geometric operations and transformations in 3D space.

glapp
Download Presentation

Composing Transformations and Geometric Operations: Understanding 3D 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. http://www.ugrad.cs.ubc.ca/~cs314/Vjan2005 Transformations IIWeek 2, Fri Jan 14

  2. Reading • same as last time, through Monday

  3. News • corrected slides posted for • Week 1 Fri • Week 2 Wed • reminder: extra handouts in CICSR 011 • reminder: my office hours are Wed 3:45-4:45 in CICSR 011

  4. Review: Homogeneous Coordinates • Cartesian coordinates y x

  5. Review: Homogeneous Coordinates • Homogeneous coordinates w w=1 y x

  6. translate(a,b,c) scale(a,b,c) Review: Transformations

  7. Shear • shear along x axis • push points to right in proportion to height y y x x

  8. Shear • shear along x axis • push points to right in proportion to height • shear in y? 3D shear in x? y y x x

  9. Shear • shear in x • shear in y • shear in z

  10. Reflection • reflect across x axis • mirror x x

  11. Reflection • reflect across x axis • mirror • reflect about Y axis? x x

  12. Undoing Transformations: Inverses (R is orthogonal)

  13. Composing Transformations • translation so translations add

  14. Composing Transformations • scaling • rotation so scales multiply so rotations add

  15. Composing Transformations Ta Tb = Tb Ta, but Ra Rb != Rb Ra and Ta Rb != Rb Ta

  16. Composing Transformations suppose we want Fh FW

  17. Composing Transformations Rotate(z,-90) suppose we want Fh FW FW Fh

  18. Composing Transformations Translate(2,3,0) Rotate(z,-90) suppose we want Fh Fh FW FW FW Fh

  19. Composing Transformations Translate(2,3,0) Rotate(z,-90) suppose we want Fh Fh FW FW FW Fh

  20. Composing Transformations • which direction to read? • right to left • interpret operations wrt fixed coordinates • moving object • left to right • interpret operations wrt local coordinates • changing coordinate system

  21. Composing Transformations • which direction to read? • right to left • interpret operations wrt fixed coordinates • moving object • left to right • interpret operations wrt local coordinates • changing coordinate system OpenGL pipeline ordering!

  22. Composing Transformations • which direction to read? • right to left • interpret operations wrt fixed coordinates • moving object • left to right • interpret operations wrt local coordinates • changing coordinate system • OpenGL updates current matrix with postmultiply • glTranslatef(2,3,0); • glRotatef(-90,0,0,1); • glVertexf(1,1,1); • specify vector last, in final coordinate system • first matrix to affect it is specified second-to-last OpenGL pipeline ordering!

  23. Composing Transformations • correctly ordering your matrices • multiply matrices together • result is one matrix • multiply vertices by this matrix • all vertices easily transformed with one matrix multiply

  24. Interpreting Transformations moving object • same relative position between object and basis vectors translate by (-1,0) (1,1) (2,1) intuitive? changing coordinate system (1,1) OpenGL

  25. Rotation About a Point: Moving Object rotate about origin translate p back translate p to origin rotate about p by : FW

  26. Rotation: Changing Coordinate Systems • same example: rotation around arbitrary center

  27. Rotation: Changing Coordinate Systems • rotation around arbitrary center • step 1: translate coordinate system to rotation center

  28. Rotation: Changing Coordinate Systems • rotation around arbitrary center • step 2: perform rotation

  29. Rotation: Changing Coordinate Systems • rotation around arbitrary center • step 3: back to original coordinate system

  30. General Transform Composition • transformation of geometry into coordinate system where operation becomes simpler • perform operation • transform geometry back to original coordinate system

  31. Rotation About an Arbitrary Axis • axis defined by two points • translate point to the origin • rotate to align axis with z-axis (or x or y) • perform rotation • undo aligning rotations • undo translation

  32. Arbitrary Rotation • problem: • given two orthonormal coordinate systems XYZ and UVW • find transformation from one to the other • answer: • transformation matrix R whose columns are U,V,W: W Y Z V X U

  33. Arbitrary Rotation • why? • similarly R(Y) = V & R(Z) = W

  34. Transforming Geometric Objects • lines, polygons made up of vertices • just transform the vertices, interpolate between • does this work for everything? no!

  35. Computing Normals • polygon: • assume vertices ordered CCW when viewed from visible side of polygon • normal for a vertex • used for lighting • supplied by model (i.e., sphere),or computed from neighboring polygons

  36. Transforming Normals • what is a normal? • a direction • homogeneous coordinates: w=0 means direction • often normalized to unit length • vs. points/vectors that are object vertex locations • what are normals for? • specify orientation of polygonal face • used when computing lighting • so if points transformed by matrix M, can we just transform normal vector by M too?

  37. Transforming Normals • translations OK: w=0 means unaffected • rotations OK • uniform scaling OK • these all maintain direction

  38. Transforming Normals • nonuniform scaling does not work • x-y=0 plane • line x=y • normal: [1,-1,0] • direction of line x=-y • (ignore normalization for now)

  39. Transforming Normals • apply nonuniform scale: stretch along x by 2 • new plane x = 2y • transformed normal: [2,-1,0] • normal is direction of line x = -2y or x+2y=0 • not perpendicular to plane! • should be direction of 2x = -y

  40. Planes and Normals • plane is all points perpendicular to normal • (with dot product) • (matrix multiply requires transpose) • explicit form: plane =

  41. Finding Correct Normal Transform • transform a plane given M, what should Q be? stay perpendicular substitute from above thus the normal to any surface can be transformed by the inverse transpose of the modelling transformation

More Related