ESC 489 3D ransforms 1 igid Bod ransforms-3d J.C. Dill transforms3d 27Jan99 hese notes on (2D and) 3D rigid bod transform are currentl in hand-done notes which are being converted to this file from that form. E (99-1): this file is incomplete; hand-written notes will be made available. Homogenous Coordinates for 3D ordinar point ( ) is represented as: ( w) recover ordinar Cartesian coordinate b dividing b w: (/w /w /w 1) as in 2D, 2 homogeneous points are same if one is a multiple of the other: H 2 ch 1 w represents the point at infinit. Convention Use HS; rotation is positive ccw looking in toward the origin. ote: Computer graphics often uses a HS. Wh is this? ransforms ranslate 1 1 1 d d d S S Scale S S otation X Ais Y Ais Z Ais c s s c c s s c 1 c s 1 s c
ESC 489 3D ransforms 2 Eample: rotate vector in X ais b +9 about Z ais [1 1 ] ( 9) c -s c s -1 1 1 1 1 1 1 1 Suggestion: make up our own eample to verif (d,d,d) and S(s,s,s ) do what ou think the should do.
ESC 489 3D ransforms 3 roperties of otation matrices Just as in 2D, the "upper left" 3 3 (in this case) submatri of the 4 4 transformation matri has some helpful properties: columns and rows are mutuall perpendicular unit vectors determinant of 3 3 1 so that these sub-matrices are Special rthogonal (sometimes called proper orthonormal) and: product of an pair of special orthogonal matrices is also special orthogonal inverse transpose ( 1 so that I ) and just like in the 2D case row vectors: unit vectors which rotate into principal aes column vectors: unit vectors into which principle aes rotate ow Vector eample (9) Upper 3 3 is ( 9) 1 1 1 ow Vectors r, r, r, ow vectors r, r, r, before rotation after rotation r r r r r r Suggested eercise: work through the column vector equivalent for (9).
ESC 489 3D ransforms 4 Inverses ranslate: Scale: otate: negate d, d, d from s to 1/ s, etc. negate the angle Shear A little more comple than for 2D since we need three flavors: SH, SH, SH, i.e. one for each coordinate plane. ote that each requires two parameters, since the shear with respect to a plane can be in either of the aes defining the plane. For eample, 1 sh sh SH 1 is the shear for -. SH (1,): General combined + An arbitrar sequence of rotations, translations and scales can be represented as: r r r t 11 12 13 r r r t 21 22 23 r r r t 32 32 33 where upper left 3 3 is the combined Scale and otate.
ESC 489 3D ransforms 5 ransforming points, lines and lanes oints: what weve been doing so far (and onl this) ines: defined b endpoints; just transform the endpoints and join the transformed points. lanes: tricker; if defined b 3 points, can transform points, but... more often defined b a plane equation: A + B + C + D how do we transform the plane equation coefficients????? answer is to transform the normal (recall n [A B C] ) ransforming the lane Equation first, represent the plane as a column vector of coefficients: [A B C D ] then the plane can be defined b all points [ 1 ] such that or A B C D 1 and from this, performing the dot product, we recover the plane equation! A + B + C + D now, in matri form, we use the row vector of coefficients, and a column vector for : ow, suppose we want to transform our space b the transformation matri : to maintain, we must also transform. et this transform be. hen * transformed normal is * transformed point is * and from the definition of the plane ( ) * so using a little matri algebra: ( ) his last statement will be true if ki ( ) ( ) * * ( ) -1 etting k 1 gives ( )
ESC 489 3D ransforms 6 Eample + + 1 ( θ) ( 9) 1 ( ) + + 1 * otate 9 deg about Ais: so or c -s s c -1 1-1 1-1 1 1 1 1 n* n
ESC 489 3D ransforms 7 Composition of 3D ransforms We illustrate this with a simplified version of the "3-point transform", where we move and orient one object with respect to another. he eample also will help understand viewing transforms. roblem: Given two directed line segments, 1 2 and 1 3, find a transform such that 1 moves to the origin 1 2 moves to the positive ais 1 3 moves to the positive - plane 3 3 1 2 1 2 he approach well take is: 1. translate to origin 2. rotate to put 2 into the - plane 3. rotate to put 2 on the positive ais 4. and finall rotate 3 into the positive - plane.
ESC 489 3D ransforms 8 Composing 3D ransforms 1 3 2 ets look at one of the transforms, sa the second (θ-9) otation is - (9 - ) - 9; (wh?) 3 1 2 θ D 1 2 3 φ 1 (- 1,- 1,- 1 ) (θ-9) 2 cos( - 9) sin sin( - 9) - cos - 2 D 2-2 1 2 2 ultipling this out we get 2 2 - D 1 2 1 1 1 (φ) and we note 2 as required. 2 1 α 3 ------------------------------------------------------------ he final overall transform is: ( α) ( φ) ( θ 9 ) (α) ------------------------------------------------------------- 3 2 1 Suggested eercise: construct the three rotation matrices and verif that the requirements are indeed met, i.e. that - 1 -> - 2 -> positive ais - 3 -> positive - plane
ESC 489 3D ransforms 9 Alternate method: Use orthonormal matri properties ecall from the "nice" properties of the rotation matrices: r r r 1 2 3 r r r 1 2 3 r r r 1 2 3 the are the unit row vectors which rotate into coordinate aes. ets tr to construct these directl, assuming the translation is alread done. i 1. the unit vector we want to move to lie on the positive ais is: 2. the unit vector that rotates into is normal to the plane 123. But a unit vector normal to the plane is simpl given b: 1 2 1 2 r r r 1 3 1 2 1 3 1 2 1 2 3 r r r 1 2 3 3. B definition, must rotate into the remaining ais and:... and thats it, were done! he transformation is: where ( 1, 1, 1) 1