3d geometric transformation
play

3D Geometric Transformation (Chapt. 5 in FVD, Chapt. 11 in Hearn - PDF document

3D Geometric Transformation (Chapt. 5 in FVD, Chapt. 11 in Hearn & Baker) 3D Coordinate Systems Right-handed coordinate system: z y x Left-handed coordinate system: y z x Reminder: Vector Product UxV V U VxU =


  1. 3D Geometric Transformation (Chapt. 5 in FVD, Chapt. 11 in Hearn & Baker) 3D Coordinate Systems • Right-handed coordinate system: z y x • Left-handed coordinate system: y z x

  2. Reminder: Vector Product UxV V θ U VxU × = θ ˆ sin U V n U V   − ˆ ˆ ˆ x y z u v u v y z z y   × = = − U V u u u  u v u v  x y z z x x z   − v v v u v u v   x y z x y y x 3D Point • A 3D point P is represented in homogeneous coordinates by a 4-dim. vector:   x   y   = P   z     1 • Note, that α     x x     α y y     = ≡ p     α z z     α     1

  3. 3D Transformations • In homogeneous coordinates, 3D transformations are represented by 4x4 matrices:   a b c t x   d e f t   y   g h i t z     0 0 0 1 • A point transformation is performed:       ' a b c t x x x       d e f t y ' y       = y       z ' g h i t z    z          1 0 0 0 1 1 3D Translation • P in translated to P' by:        +  1 0 0 t ' x x x t x x         + 0 1 0 t y y ' y t         y = = y         + 0 0 1 t z z ' z t  z  z              0 0 0 1  1 1 1 = T P P ' Or z y x − = 1 T P ' P • Inverse translation:

  4. Scaling         a 0 0 0 x x ' ax         0 b 0 0 y y ' by         = =         0 0 c 0 z z ' cz                 0 0 0 1 1 1 1 = S P P ' Or z z y y x x − = 1 S P ' P 3D Shearing • Shearing:      + +  1 a b 0 x x ay bz       + + c 1 d 0 y cx y dz       =       + + e f 1 0 z ex fy z             0 0 0 1 1 1 • The change in each coordinate is a linear combination of all three. • Transforms a cube into a general parallelepiped.

  5. 3D Rotation • To generate a rotation in 3D we have to specify: – axis of rotation (2 d.o.f) – amount of rotation (1 d.o.f) • Note, the axis passes through the origin. y z x • A counter-clockwise rotation about the z- axis:    θ − θ    x ' cos sin 0 0 x       θ θ y ' sin cos 0 0 y       =       z ' 0 0 1 0 z        1   0 0 0 1   1  = θ p ' R ( ) p z z y x

  6. • A counter-clockwise rotation about the x- axis:       x ' 1 0 0 0 x       θ − θ y ' 0 cos sin 0 y       =       θ θ z ' 0 sin cos 0 z             1 0 0 0 1 1 θ = ' ( ) p R p x z y x • A counter-clockwise rotation about the y- axis:    θ θ    x ' cos 0 sin 0 x       y ' 0 1 0 0 y       =       − θ θ z ' sin 0 cos 0 z             1 0 0 0 1 1 = θ p ' R ( ) p y z y x

  7. Inverse Rotation − θ θ = 1 = − ( ) ' ( ) ' p R p R p Composite Rotations • R x , R y , and R z, can perform any rotation about an axis passing through the origin. Rotation About an Arbitrary Axis • Axis of rotation can be located at any point: 6 d.o.f. • The idea : make the axis coincident with one of the coordinate axes (z axis), rotate, and then transform back. • Assume that the axis passes through the point p 0 . z p 0 y x

  8. • Transformations: – Translate P 0 to the origin. – Make the axis coincident with the z -axis (for example): • Rotate about the x -axis into the xz plane. • Rotate about the y -axis onto the z -axis. • Rotate as needed about the z - axis. • Apply inverse rotations about y and x . • Apply inverse translation. y y A p 0 D p 0 x x z z y y E p 0 p 0 B x x z z y y p 0 F p 0 C x x z z

  9. 3D Reflection • A reflection through the xy plane:       1 0 0 0 x x       0 1 0 0 y y       =       − − 0 0 1 0 z z             0 0 0 0 1 1 • Reflections through the xz and the yz planes are defined similarly. • How can we reflect through some arbitrary plane? Transforming Planes • Plane representation: – By three non-collinear points – By implicit equation:   x   [ ] y   + + + = = 0 Ax By Cz D A B C D   z     1   A B C 1     D D D P 1 P 2 [ ] x y z 1 P 0

  10. • One way to transform a plane is by transforming any three non- collinear points on the plane. • Another way is to transform the plane equation: Given a transformation T that transforms [ x,y,z,1 ] to [ x',y',z',1 ] find [A',B',C',D'], such that:   x '   [ ] y '   = A ' B ' C ' D ' 0   z '    1  • Note that   x   [ ] y   − = 1 A B C D T T 0   z     1 • Thus, the transformation that we should apply to the plane equation is:     A ' A     ( ) B ' B     − T = 1 T     ' C C         D ' D

  11. Changing Coordinate Systems • Problem : Given the XYZ orthogonal coordinate system, find a transformation, M, that maps XYZ to an arbitrary orthogonal system UVW . • This transformation changes a representation from the UVW system to the XYZ system. w =(w x ,w y ,w z ) z (x 0 ,y 0 ,z 0 ) u= (u x ,u y ,u z ) y x v= (v x ,v y ,v z ) • Solution : M=RT where T is a translation matrix by (x 0 ,y 0 ,z 0 ), and R is rotation matrix whose columns are U , V , and W :   u v w 0 x x x   u v w 0   = y y y R   u v w 0 z z z    0 0 0 1  because       u v w 0 1 u x x x x       u v w 0 0 u       = = = y y y y RX U       u v w 0 0 u z z z z        0 0 0 1   1   1 

  12. • Similarly, Y goes into V, and Z goes into W. • The inverse transform, T -1 R -1, provides the mapping from UVW back to XYZ. For the rotation matrix R -1 =R T :     u u u 0 u x y z x     v v v 0 u     = x y z y T R U     w w w 0 u x y z z         0 0 0 1 1     + + 2 2 2 1 u u u  x y z      0 0   = = = X     0 0        1    1 • Comment : Very useful if an arbitrary plane is to be mapped to the XY plane or vice versa. • Possible to apply if an arbitrary vector is to be mapped to an axis (How?).

  13. Transformation Pipe-Line Modeling Coordinates Modeling Transformation World Coordinates Viewing Transformation Viewing Coordinates Projection Transformation Projection Coordinates Workstation Transformation Device Coordinates Modeling Coordinate Hierarchy z w world y w x w Tractor System Front-Wheel System World transformation Tractor transformation Front-wheel

Recommend


More recommend