130 likes | 447 Views
3D Geometric Transformation. N. Point in 3D space Position (x, y, z) Color (r, g, b) Normal (Nx, Ny, Nz) Homogenous Coordinates Position (x,y,z,w) Usually (x,y,z,1) Transformations Translation Scaling Rotation Projection. (x,y,z). 3D Translation. T(dx,dy,dz)=. 1 0 0 dx
E N D
3D Geometric Transformation N • Point in 3D space • Position (x, y, z) • Color (r, g, b) • Normal (Nx, Ny, Nz) • Homogenous Coordinates • Position (x,y,z,w) • Usually (x,y,z,1) • Transformations • Translation • Scaling • Rotation • Projection (x,y,z)
3D Translation T(dx,dy,dz)= 1 0 0 dx 0 1 0 dy 0 0 1 dz 0 0 0 1 (x,y,z) To translate the point (x,y,z) by the offset (dx, dy, dx) T(dx,dy,dz) . (x,y,z,1)T =(x+dx, y+dy, z+dz,1) (x’,y’,z’)
3D Scaling (x’,y’,z’) S(sx,sy,sz)= sx 0 0 0 0 sy 0 0 0 0 sz 0 0 0 0 1 (x,y,z) To scale the vector (x,y,z) by the factors sx,sy,and sz S(sx,sy,sz) . (x,y,z,1)T =(x*sx, y*sy, z*sz,1)
3D Sheering Sheer along one or more axes Sz(hx,hy)= 1 0 hx 0 0 1 hy 0 0 0 1 0 0 0 0 1 (x’,y’,z’) (x,y,z) To sheer the point (x,y,z) along the x and y axes H(hx,hy) . (x,y,z,1)T = (x+hx*z, y+hy*z, z, 1)
3D Rotation To rotate a point (x,y,z) around the x axis by angle j Rx(j) = 1 0 0 0 0 cos(j) -sin(j) 0 0 sin(j) cos(j) 0 0 0 0 1 (x,y,z) x (x’,y’,z’) A 90o Rotation of (0,1,0,1) will produce (0,0,1,1)
3D Rotation To rotate a point (x,y,z) around the y axis by angle j Ry(j) = cos(j) 0 sin(j) 0 0 1 0 0 -sin(j) 0 cos(j) 0 0 0 0 1 (x,y,z) (x’,y’,z’) A 90o Rotation of (1,0,0,1) will produce (0,0,1,1)
3D Rotation To rotate a point (x,y,z) around the z axis by angle j Rz(j) = cos(j) -sin(j) 0 0 sin(j) cos(j) 0 0 0 0 1 0 0 0 0 1 (x,y,z) x A 90o Rotation of (1,0,0,1) will produce (0,1,01) (x’,y’,z’)
Composition of 3D Transformations General 3D transformation looks as the following T = t00 t01 t02 t03 t10 t11 t12 t13 t20 t21 t22 t23 t30 t31 t32 t33 We should split the transformation into its generic composing transformations. Then carry these transformation one by one.