walters@buffalo.edu CSE 480/580 Lecture 2 Slide 3-D Transformations 3-D space Two conventions for coordinate sstems Left-Hand vs Right-Hand (Thumb is the ais, inde is the ais) Which is which? Most graphics sstems use left hand coordinates Homogeneous Coordinates 3-D point (,,) Homogeneous (,,,)
walters@buffalo.edu CSE 480/580 Lecture 2 Slide2 Translation (',',',) (t, t, t, 0) + (,,,) ' ' ' 0 0 t 0 0 t 0 0 t ' ' ' Scaling Rotation s 0 0 0 0 s 0 0 0 0 s 0 Not as simple to etend to 3D 3 possible aes to rotate about All rotations counter clockwise - when looking down the ais B' B 2D is rotation about what ais? 2D
walters@buffalo.edu CSE 480/580 Lecture 2 Slide3 Notes: When rotating about a given ais, the coordinates of that ais are alwas unchanged So in the rotation matrices, the row and column of the rotation ais are as the identit matri Rotation Matrices differ for right and left hand sstems (Use right-hand here (assume in modelling coordinate sstem)) So what is the rotation about the ais? R( ) cos -sin 0 0 sin cos 0 0 0 0 0 R( ) 0 0 0 0 cos -sin 0 0 sin cos 0 R( ) cos 0 sin 0 0 0 0 -sin 0 cos 0
walters@buffalo.edu CSE 480/580 Lecture 2 Slide4 How would one rotate an object about an ais that is parallel to an ais of the coordinate sstem? origin of w (,,0) w is parallel to w Does this completel specif? Translate w to Rotate b about Translate back ' ' ' 0 0 -t 0 0 -t 0 0 -t 0 0 0 0 cos -sin 0 0 sin cos 0 0 0 t 0 0 t 0 0 t For eample above, what are values for translations?
walters@buffalo.edu CSE 480/580 Lecture 2 Slide5 How to rotate about an arbitrar ais Translate and rotate arbitrar ais onto a coordinate ais Perform rotation Back transform How transform arbitrar ais onto a coordinate ais? Translate origin of arbitrar ais to origin of coordinate aes ' ' ' 0 0 t 0 0 t 0 0 t If use P - get rotation one wa about the line PP2 If use P2 - get rotation other wa P (,, ) P2 (2, 2, 2) What values of t, t, and t? ' ' ' 0 0 0 0 0 0
walters@buffalo.edu CSE 480/580 Lecture 2 Slide6 Now rotate P2 onto the ais (we will rotate about the ais - could choose an ais) But can't rotate about an arbitrar ais! Solution: break into two rotations about coordinate aes Rotate about ais until P2 lies in plane Rotate about ais until P2 lies on ais Look at unit vector, u, along PP2 u' u Look at projection, u', of u onto plane u' b u' (0, b, c) Need to rotate u such that u' lies on ais Let d à b 2 + c 2 sin b/d cos c/d c R( ) 0 0 0 0 cos -sin 0 0 sin cos 0 0 0 0 0 c/d -b/d 0 0 b/d c/d 0
walters@buffalo.edu CSE 480/580 Lecture 2 Slide7 Now need to rotate about until P2 lies on ais u'' is the result of last rotation u'' (a, 0, d) sin -a u'' cos d R( ) cos 0 sin 0 0 0 0 -sin 0 cos 0 d 0 -a 0 0 0 0 a 0 d 0 Now can rotate b desired amount about ais R(½) cos ½ -sin ½ 0 0 sin ½ cos ½ 0 0 0 0 0
walters@buffalo.edu CSE 480/580 Lecture 2 Slide8 Rotation transformation up to this point cos ½ -sin ½ 0 0 sin ½ cos ½ 0 0 0 0 0 d 0 -a 0 0 0 0 a 0 d 0 0 0 0 0 c/d -b/d 0 0 b/d c/d 0 cos ½ -sin ½ 0 0 sin ½ cos ½ 0 0 0 0 0 d -ab/d -ac/d 0 0 c/d -b/d 0 a b c 0 And don't forget that initial translation: cos ½ -sin ½ 0 0 sin ½ cos ½ 0 0 0 0 0 d -ab/d -ac/d 0 0 c/d -b/d 0 a b c 0 0 0-0 0-0 0 - What are a, b, c, and d in terms of P and P2? u' c b How transform PP2 to unit vector? Alread moved P to origin P'2 (2-, 2-, 2-) P'2 (',',') Divide b its length to give it unit length D length Ã(' 2 +' 2 +' 2 ) b '/D, c '/D, d Ã(b 2 +c 2 ) a '/D
walters@buffalo.edu CSE 480/580 Lecture 2 Slide9 To complete rotation must now back transform with two rotations and the translation, all with minus values What about scaling an object relative to a fied point? Translate fied point to the origin Scale Back translate ' ' ' 0 0 -t 0 0 -t 0 0 -t s 0 0 0 0 s 0 0 0 0 s 0 0 0 0 0 0 0 t 0 0 t 0 0 t ' ' ' s 0 0 -t 0 s 0 -t 0 0 s -t 0 0 t 0 0 t 0 0 t ' ' ' What are t, t and t here?
walters@buffalo.edu CSE 480/580 Lecture 2 Slide0 Properties of 3-D Affine Transformations Lines are transformed into lines Parallel lines are transformed into parallel lines Proportional distances are preserved Volumes are scaled b the determinant of M, where M is the transformation matri P' M P Vol (P') M Vol (P) Note: It's not true that the 2D projections of these 3D transformations have these properties! This is the projection of a unit cube Is the length preserved?