Review of Vectors • Right-handed versus left-handed systems • Positive rotation angles for right-handed systems -2• Homogeneous coordinates of a 3D point - Idea: add a third coordinate: (x, y, z) --> (x h , y h , z h , w) - Homogenize (x h , y h , z h , w): x= yh zh xh , y= ,z= ,w≠0 w w w - In general: (x, y, z) --> (xw, yw, zw, w) (i.e., x h =xw, y h =yw, z h =zw) - w can assume any value (w ≠ 0), for example, w = 1: (x, y, z) − − > (x, y, z, 1) (no division is required when you homogenize !!) (x, y, z) − − > (2x, 2y, 2z, 2) (division is required when you homogenize !!) - Each point (x, y, z) correponds to a line in the 4D-space of homogeneous coordinates -3- 3D Geometrical Transformations • Translation y . P’(x’,y’,z’) . P(x,y,z) x z x′ 1 y′ 0 = z′ 0 1 0 0 1 0 0 0 0 1 0 dx x dy y dz z 1 1 (Verification: x′ = 1x + 0y + 0z + 1dx = x + dx) (Verification: y′ = 0x + 1y + 0z + 1dy = y + dy) (Verification: z′ = 0x + 0y + 1z + 1dz = z + dz) (Homogenize: divide by 1 !!) P′ = T (dx, dy, dz) P • Scale -4 x′ s x y′ 0 = z′ 0 1 0 0 sy 0 0 0 0 sz 0 0 x 0 y 0 z 1 1 P′ = S(s x , s y , s z ) P • Rotation - Rotation about the z-axis x′ = xcos( ) − ysin( ) y′ = xsin( ) + ycos( ) z′ = z x′ cos( ) −sin( ) y′ sin( ) cos( ) = 0 z′ 0 0 1 0 P′ = R z ( ) P 0 0 1 0 0 x 0 y 0 z 1 1 -5- Rotation about the x-axis x′ = x y′ = ycos( ) − zsin( ) z′ = ysin( ) + zcos( ) x′ 1 y′ 0 = z′ 0 1 0 0 0 cos( ) −sin( ) sin( ) cos( ) 0 0 P′ = R x ( ) P 0 x 0 y 0 z 1 1 -6- Rotation about the y-axis x′ = zsin( ) + xcos( ) y′ = y z′ = zcos( ) − xsin( ) x′ cos( ) y′ 0 = z′ −sin( ) 1 0 sin( ) 0 cos( ) 0 0 1 0 0 P′ = R y ( ) P 0 x 0 y 0 z 1 1 -7• Change of coordinate systems - Suppose that you know the coordinates of P 3 in the xyz system and that you need its coordinates in the R x R y R z system. * You need to recover the transformation T from R x R y R z to xyz. * Apply T on P 3 to compute its coordinates in the R x R y R z system. - Assume that u x , u y , and u z are the unit vectors in the xyz coordinate system. - Assume that r x , r y , and r z are the unit vectors in the R x R y R z coordinate system (important: r x , r y , and r z are represented in the xyz coordinate system). - Find a mapping that will map r z → u z , r y → u x , and r y → u y 0 a11 0 a21 = 1 a31 1 0 a12 a22 a32 0 a13 a23 a33 0 0 rzx 0 rzy (r z → u z ) 0 r zz 1 1 (1) 1 a11 0 a21 = 0 a31 1 0 a12 a22 a32 0 a13 a23 a33 0 0 r xx 0 r xy (r x → u x ) 0 r xz 1 1 (2) -8 0 a11 1 a21 = 0 a31 1 0 a12 a22 a32 0 a13 a23 a33 0 0 r yx 0 r yy (r y → u y ) 0 r yz 1 1 From (1): aT3 r z = 1 or a3 = r z From (2): aT1 r x = 1 or a1 = r x From (3): aT2 r y = 1 or a2 = r y Thus, R = 0 r Tx r Ty r Tz 0 - Verify 1 rx 0 R = 0 1 1 0 ry 1 R = 0 1 1 0 rz 0 R = 1 1 1 0 0 0 0 1 (3)