09transformation3d

763 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
763
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
28
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

09transformation3d

  1. 1. 3D Geometric Transformation 고려대학교 컴퓨터 그래픽스 연구실
  2. 2. Contents <ul><li>Translation </li></ul><ul><li>Scaling </li></ul><ul><li>Rotation </li></ul><ul><li>Rotations with Quaternions </li></ul><ul><li>Other Transformations </li></ul><ul><li>Coordinate Transformations </li></ul>
  3. 3. Transformation in 3D <ul><li>Transformation Matrix </li></ul>3  3 : Scaling, Reflection, Shearing, Rotation 3  1 : Translation 1  3 : Homogeneous representation 1  1 : Uniform global Scaling
  4. 4. 3D Translation <ul><li>Translation of a Point </li></ul>x z y
  5. 5. 3D Scaling <ul><li>Uniform Scaling </li></ul>x z y
  6. 6. Relative Scaling <ul><li>Scaling with a Selected Fixed Position </li></ul>x x x x z z z z y y y y Original position Translate Scaling Inverse Translate
  7. 7. 3D Rotation <ul><li>Coordinate-Axes Rotations </li></ul><ul><ul><li>X-axis rotation </li></ul></ul><ul><ul><li>Y-axis rotation </li></ul></ul><ul><ul><li>Z-axis rotation </li></ul></ul><ul><li>General 3D Rotations </li></ul><ul><ul><li>Rotation about an axis that is parallel to one of the coordinate axes </li></ul></ul><ul><ul><li>Rotation about an arbitrary axis </li></ul></ul>
  8. 8. Coordinate-Axes Rotations <ul><li>Z-Axis Rotation </li></ul><ul><li>X-Axis Rotation </li></ul><ul><li>Y-Axis Rotation </li></ul>z y x z y x z y x
  9. 9. Order of Rotations <ul><li>Order of Rotation Affects Final Position </li></ul><ul><ul><li>X-axis  Z-axis </li></ul></ul><ul><ul><li>Z-axis  X-axis </li></ul></ul>
  10. 10. General 3D Rotations <ul><li>Rotation about an Axis that is Parallel to One of the Coordinate Axes </li></ul><ul><ul><li>Translate the object so that the rotation axis coincides with the parallel coordinate axis </li></ul></ul><ul><ul><li>Perform the specified rotation about that axis </li></ul></ul><ul><ul><li>Translate the object so that the rotation axis is moved back to its original position </li></ul></ul>
  11. 11. General 3D Rotations <ul><li>Rotation about an Arbitrary Axis </li></ul><ul><li>Basic Idea </li></ul><ul><li>Translate (x1, y1, z1) to the origin </li></ul><ul><li>Rotate (x’2, y’2, z’2) on to the z axis </li></ul><ul><li>Rotate the object around the z-axis </li></ul><ul><li>Rotate the axis to the original orientation </li></ul><ul><li>Translate the rotation axis to the original position </li></ul>(x 2 ,y 2 ,z 2 ) (x 1 ,y 1 ,z 1 ) x z y R -1 T -1 R T
  12. 12. General 3D Rotations <ul><li>Step 1. Translation </li></ul>(x 2 ,y 2 ,z 2 ) (x 1 ,y 1 ,z 1 ) x z y
  13. 13. General 3D Rotations <ul><li>Step 2. Establish [ T R ]  x x axis </li></ul>(a,b,c) (0,b,c) Projected Point   Rotated Point x y z
  14. 14. Arbitrary Axis Rotation <ul><li>Step 3. Rotate about y axis by  </li></ul>(a,b,c) (a,0,d)  l d x y Projected Point z Rotated Point
  15. 15. Arbitrary Axis Rotation <ul><li>Step 4. Rotate about z axis by the desired angle  </li></ul> l y x z
  16. 16. Arbitrary Axis Rotation <ul><li>Step 5. Apply the reverse transformation to place the axis back in its initial position </li></ul>x y l l z
  17. 17. Example Find the new coordinates of a unit cube 90º-rotated about an axis defined by its endpoints A(2,1,0) and B(3,3,1). A Unit Cube
  18. 18. Example <ul><li>Step1. Translate point A to the origin </li></ul>A’(0,0,0) x z y B’(1,2,1)
  19. 19. Example <ul><li>Step 2. Rotate axis A’B’ about the x axis by and angle  , until it lies on the xz plane. </li></ul>x z y l B’(1,2,1)  Projected point (0,2,1) B”(1,0,  5)
  20. 20. Example <ul><li>Step 3. Rotate axis A’B’’ about the y axis by and angle  , until it coincides with the z axis. </li></ul>x z y l  B”(1,0,  5) (0,0,  6)
  21. 21. Example <ul><li>Step 4. Rotate the cube 90° about the z axis </li></ul><ul><ul><li>Finally, the concatenated rotation matrix about the arbitrary axis AB becomes, </li></ul></ul>
  22. 22. Example
  23. 23. Example <ul><li>Multiplying R ( θ ) by the point matrix of the original cube </li></ul>
  24. 24. Rotations with Quaternions <ul><li>Quaternion </li></ul><ul><ul><li>Scalar part s + vector part v = ( a , b , c ) </li></ul></ul><ul><ul><li>Real part + complex part (imaginary numbers i , j , k ) </li></ul></ul><ul><li>Rotation about any axis </li></ul><ul><ul><li>Set up a unit quaternion ( u : unit vector) </li></ul></ul><ul><ul><li>Represent any point position P in quaternion notation ( p = ( x , y , z )) </li></ul></ul>
  25. 25. Rotations with Quaternions <ul><ul><li>Carry out with the quaternion operation ( q -1 =( s , – v ) ) </li></ul></ul><ul><ul><li>Produce the new quaternion </li></ul></ul><ul><ul><li>Obtain the rotation matrix by quaternion multiplication </li></ul></ul><ul><ul><li>Include the translations: </li></ul></ul>
  26. 26. Example <ul><li>Rotation about z axis </li></ul><ul><ul><li>Set the unit quaternion: </li></ul></ul><ul><ul><li>Substitute a = b =0 , c =sin( θ /2) into the matrix: </li></ul></ul>
  27. 27. Other Transformations <ul><li>Reflection Relative to the xy Plane </li></ul><ul><li>Z-axis Shear </li></ul>x z y x z y
  28. 28. Coordinate Transformations <ul><li>Multiple Coordinate System </li></ul><ul><ul><li>Local (modeling) coordinate system </li></ul></ul><ul><ul><li>World coordinate scene </li></ul></ul>Local Coordinate System
  29. 29. Coordinate Transformations <ul><li>Multiple Coordinate System </li></ul><ul><ul><li>Local (modeling) coordinate system </li></ul></ul><ul><ul><li>World coordinate scene </li></ul></ul>Word Coordinate System
  30. 30. Coordinate Transformations <ul><li>Example – Simulation of Tractor movement </li></ul><ul><ul><li>As tractor moves, tractor coordinate system and front-wheel coordinate system move in world coordinate system </li></ul></ul><ul><ul><li>Front wheels rotate in wheel coordinate system </li></ul></ul>
  31. 31. Coordinate Transformations <ul><li>Transformation of an Object Description from One Coordinate System to Another </li></ul><ul><li>Transformation Matrix </li></ul><ul><ul><li>Bring the two coordinates systems into alignment </li></ul></ul><ul><ul><li>1. Translation </li></ul></ul>u ' y u ' z u ' x x y z (0,0,0) y’ z’ x’ u ' y u ' z u ' x ( x 0 , y 0 , z 0 ) x y z (0,0,0)
  32. 32. Coordinate Transformations <ul><ul><li>2. Rotation & Scaling </li></ul></ul>y’ z’ x’ u ' y u ' z u ' x u ' y u ' z u ' x u ' y u ' z u ' x x y z (0,0,0) x y z (0,0,0) x y z (0,0,0)

×