Upcoming SlideShare
×

Week9 3 D Transformations

1,048 views

Published on

1 Like
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total views
1,048
On SlideShare
0
From Embeds
0
Number of Embeds
17
Actions
Shares
0
56
0
Likes
1
Embeds 0
No embeds

No notes for slide

Week9 3 D Transformations

1. 1. 3D Transformations
2. 2. 3D homogeneous coordinates <ul><li>In 2D, we added a dimension so translations could be computed by matrix multiplication, just like all the other transformations. </li></ul><ul><li>In 3D, we’ll do the same trick, projecting up into a 4D space to do transformations, then projecting back down after. </li></ul>
3. 3. Translation (x’,y’,z’) (x,y,z) T=(t x ,t y ,t z )
4. 4. Scaling
5. 5. Rotation <ul><li>How should we specify rotations? </li></ul><ul><li>In 2D, it was always counterclockwise in the xy-plane. </li></ul><ul><li>In 3D, we have more choices. </li></ul><ul><ul><li>xz-plane, yz-plane, an arbitrary plane. </li></ul></ul><ul><li>We could specify these in terms of the vector perpendicular to the plane of rotation. </li></ul><ul><ul><li>z axis, y-axis, x-axis, arbitrary axis </li></ul></ul>
6. 6. Rotation about a major axis
7. 7. Rotation about an arbitrary axis <ul><li>How do we specify this? </li></ul><ul><li>R( r x , r y , r z ,  ) </li></ul><ul><li>So we need a vector and an angle: </li></ul><ul><ul><li>The axis of rotation is from the origin and through the point r </li></ul></ul><ul><ul><li>The rotation is counterclockwise about the axis </li></ul></ul>
8. 8. What are the steps? <ul><li>Rotate the axis of rotation so it lies on some major axis. </li></ul><ul><li>Apply specified rotation about major axis. </li></ul><ul><li>Apply inverse rotation to return axis or rotation to original orientation. </li></ul>
9. 9. Math! <ul><li>We need to figure out the rotations to align the axes. </li></ul><ul><li>First, compute a unit vector pointing in the same direction as the axis of rotation. </li></ul><ul><li>Now we can compute the rotation directly from the unit vector. </li></ul>
10. 10. More math! <ul><li>First, rotate u into the xz-plane – rotation around the x-axis. </li></ul><ul><li>We can temporarily ignore the x component of u to do this: </li></ul><ul><li>Second, rotate u” onto the z-axis – rotation around the y-axis. </li></ul>
11. 11. Picture this u=<a,b,c> u”=<a,0,d> u’ =<0,b,c>  u =<a,b,c>  u z =<0,0,1> u”=<a,0,d> u z =<0,0,1>
12. 12. Putting it together <ul><li>Don’t forget the rotation about the z-axis! </li></ul><ul><li>P’ = R( u x ,–  ) · R( u y ,–  ) · R( u z ,  ) · R( u y ,  ) · R( u x ,  ) · P </li></ul>
13. 13. Other rotations <ul><li>What if the axis of rotation does not pass through the origin? </li></ul><ul><li>Similar process as in 2D, translate to the origin, rotate as normal, translate back. </li></ul><ul><li>We just need to know a point on the axis that we can translate to the origin. </li></ul><ul><li>Only way to specify such a rotation is to give two points on the line or one point and a direction, so the requirement is easily satisfied. </li></ul>
14. 14. Another way to get the rotation matrix <ul><li>We can compute it as a coordinate system transformation: </li></ul>x y z u’ z u’ x u’ y