Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Perron–Frobenius theorem wikipedia , lookup
Singular-value decomposition wikipedia , lookup
Cayley–Hamilton theorem wikipedia , lookup
Matrix calculus wikipedia , lookup
Covariance and contravariance of vectors wikipedia , lookup
Matrix multiplication wikipedia , lookup
Orthogonal matrix wikipedia , lookup
Four-vector wikipedia , lookup
Three Dimensional Modeling Transformations Three Dimensional Modeling Transformations Methods for object modeling transformation in three dimensions are extended from two dimensional methods by including consideration for the z coordinate. Three Dimensional Modeling Transformations Generalize from 2D by including z coordinate Straightforward for translation and scale, rotation more difficult Homogeneous coordinates: 4 components Transformation matrices: 4×4 elements 3D Point We will consider points as column vectors. Thus, a typical point with coordinates (x, y, z) is represented as: x y z 3D Point Homogenous Coordinate A 3D point P is represented in homogeneous coordinates by a 4-dim. Vect: x y P z 1 3D Point Homogenous Coordinate We don't lose anything The main advantage: it is easier to compose translation and rotation Everything is matrix multiplication x y z 1 3D Coordinate Systems Right Hand Left Hand coordinate coordinate system: system: 3D Transformation In homogeneous coordinates, 3D transformations are represented by 4×4 matrixes: a b d e g h 0 0 c f i 0 t t t 1 x y z 3D Translation Moving one object from one point to other point 3 D TRANSLATION In translation, an object is displaced and direction from its original position. If the displacement is given by the vector v= txi+txj+tzk, The new object point p’=(x’,z’,z’) can be found by applying the transform Ttx,ty,tz to p=(x,y,z) Here tx=distance moved by object along x-axis ty=distance moved by object along y-axis tz=distance moved by object along z-axis 3D Translation P is translated to P' by: P T P x 1 y 0 z 0 1 0 0 0 t x x 1 0 t y y 0 1 tz z 0 0 1 1 Q1 find the new coordinates of a point p(4,2,1) after it is translated by distance 2,3 and 5 units x,y and z-axis?? SOLUTION : here tx=2,tx3 and tz=5 x’ 1 0 0 tx y’ = 0 1 0 ty z’ 0 0 1 tz 1 0 0 0 1 x’ y’ z’ 1 1 = 0 0 0 0 1 0 0 0 0 1 0 2 3 5 1 4 2 1 1 x’=4+2=6 y’=2+3=5 z’=1+5=6 hence the new coordinates will be p’(6,5,6) 3D Translation An Object represented as a set of polygon surfaces, is translated by translate each vertex of each surface and redraw the polygon facets in the new position. x, y, z T t x , t y , t z x' , y' , z' Inverse Translation: T (t , t , t ) T (t ,t ,t ) 1 x y z x y z T-tx,-ty,-tz 1 0 = 0 0 0 1 0 0 0 -tx 0 -ty 1 -tz 0 1 The transformed equation will become x’=x-tx y’=y-ty z’=z-tz 3D Rotation 3D Rotation In general, rotations are specified by a rotation axis and an angle. In two-dimensions there is only one choice of a rotation axis that leaves points in the plane. 3D Rotation The easiest rotation axes are those that parallel to the coordinate axis. Positive rotation angles produce counterclockwise rotations about a coordinate axix, if we are looking along the positive half of the axis toward the coordinate origin. Coordinate Axis Rotations Coordinate Axis Rotations Z-axis rotation: rotation about z-axis in anticlockwise direction x' cos y ' sin z' 0 1 0 sin cos 0 0 0 0 1 0 0 x 0 y 0 z 1 1 P R z (θ) P ROTATION ABOUT Z-AXIS IN CLOCKWISEDIRECTION. Note that the +ve values of rotation angle Ө will produce a rotation in the anticlockwise direction whereas –ve values ofӨ produce a rotation in the clockise direction. in this case angle Ө is taken as –ve. According to the trigonometric law cos(Ө)= cos Ө sin(- Ө)= -sin Ө Now the matrix become x' cos sin 0 0 x y ' sin z' 0 1 0 cos 0 0 P R z ( ) P 0 1 0 0 y 0 z 1 1 Coordinate Axis Rotations Obtain rotations around other axes through cyclic permutation of coordinate parameters: xyzx X-axis rotation in anticlockwise direction: 0 x' 1 y ' 0 cos z ' 0 sin 0 1 0 0 sin cos 0 0 x 0 y 0 z 1 1 P R () P x X-axis rotation in anticlockwise direction: x' 1 y ' 0 z ' 0 1 0 0 cos sin 0 0 sin cos 0 0 x 0 y 0 z 1 1 P Rx( ) P X-axis rotation in clockwise direction: In this case angle Ө is taken as –ve. According to the trigonometric law cos(Ө)= cos sin(- Ө)= -sin Ө P Rx( ) P x' 1 y ' 0 z ' 0 1 0 0 cos sin 0 0 sin cos 0 0 x 0 y 0 z 1 1 Y-axis rotation in anticlockwise direction P R () P y x' cos y ' 0 z ' sin 1 0 0 sin 0 x 1 0 0 y 0 cos 0 z 0 0 1 1 Y-axis rotation in clockwise direction P R y ( ) P x' cos y ' 0 z ' sin 1 0 0 1 0 0 sin 0 cos 0 0 x 0 y 0 z 1 1 3D Scaling SCALING TRANSFORMATION A scaling transformation alters the size of an object. An object can be scaled(streched or shrunk) along the x,y and z axis by multiplying all its points by the scale factors sx,Sy,Sz All points P(x,y,z) on the scaled shape will now become P’(x’,y’,z’). Such that x’=x.Sx y’=y,Sy z’=z.zSz 3D Scaling Sx,Sy and Sz are scaling factors along x,y and z directions.. P’(x’y’z’) Scaling P(x,y,z P S P x s x y 0 z 0 1 0 0 0 sy 0 0 sz 0 0 0 x 0 y 0 z 1 1 SCALING TRANSFORMATION If values of Sx,Sy and Sz<1 then size of objects reduced or the object move closer to the coordinate origin. If values of Sx,Sy and Sz>1 then size of objects increased or the object move farther to the coordinate origin. Quo. Magnify a prism by the vertices A(1,4,3), B(4,2,3),(6,5,3) and D(3,4,5) to twice its size. Solution:The new coordinates of prism is formed from original coordinates as follow: p’=S2,2,2.p A’B’C’D’ =S2,2,2 . ABCD 2 = 0 0 0 2 = 8 6 1 0 2 0 0 8 4 6 1 0 0 0 0 2 0 0 1 12 6 10 8 6 10 1 1 1 4 3 1 4 2 3 1 6 5 3 1 3 4 5 1 Composite 3D Transformations Composite Transformation With the matrix representation , we can set up a matrix for any sequence of transformations as a composite transformation matrix by calculating the matrix product of the individual transformations. Forming products of transformation matrices is often referred to as a concatenation, or composition, of matrices. For column matrix representation of coordinate positions, we form composite transformations by multiplying matrices in order from right to left. That is, each successive transformation matrix premultiplies the product of the preceding transformation matrices. Composite 3D Transformations Same way as in two dimensions: Multiply matrices Rightmost term in matrix product is the first transformation to be applied SCALING ABOUT THE FIXED POINT Scaling with respect to a selected fixed position(x,y,z) can be represented with the following transformation equation sequence. 1. translate the fixed point to the origin. 2. Scale the object relative to the coordinate origin. 3.translate the fixed point back to its original position. The matrix representation for an arbitrary fixed-point scaling can then be expressed as the concatenation of these translate-scaletranslate transformation as P’=T(xf,yf,zf).S(sx,sy,sz).T(-xf,-yf,-zf).P X’ 1 Y’ = 0 Z’ 0 1 0 0 1 0 0 0 0 1 0 tx ty tz 1 x' s x y ' 0 z' 0 1 0 sx 0 0 sy 0 0 0 0 0 0 1 0 0 0 0 1 sz 0 0 0 0 1 0 0 0 0 sy 0 0 sz 0 0 0 0 1 0 tx ty tz 1 (1 s x ) x f x y (1 s y ) y f (1 s z ) z f z 1 1 x’ x y’ y z’ z 1 1 3D Reflections 3D Reflections About an axis: equivalent to 180˚rotation about that axis 3D Reflections About a plane: A reflection through the xy plane: x 1 y 0 z 0 1 0 0 x 1 0 0 y 0 1 0 z 0 0 1 1 0 0 A reflections through the xz and the yz planes are defined similarly. 3D Shearing 3D Shearing Modify object shapes Useful for perspective projections: E.g. draw a cube (3D) on a screen (2D) Alter the values for x and y by an amount proportional to the distance from zref 3D Shearing 1 0 M zshear 0 0 0 shzx 1 shzy 0 1 0 0 shzx z ref shzy z ref 0 1 Transformations Between Coordinate Systems Transformations Between Coordinate ystems Translate such that the origins overlap Rotate such that the axes overlap y y' uy ' ( x0 , y0 , z0 ) (0,0,0) x x' uz ' z' z u ' x1 u ' R T y1 u ' z1 0 ux ' u'x 2 u'x3 u' y 2 u' y3 u'z 2 u'z3 0 0 0 0 T x0 , y0 , z0 0 1 Tilting transformation Tilting is defined as rotation about X-axis followed by rotation about Y-axis or vice versa. So it is a composite transformation. The effect of first transformation i.e rotation about X-axis will make the given vector lie in the YZ plane. The effect of second transformation rotation about y-axis will make the vector aligns the given line either with Zaxis or with the x=axis In order to obtain the required tilting matrix, we have to perform the following two rotations 1.rotation about x-axis by an angle α 2.rotation about y-axis by an angle β y y Rx(β) Rx(a) x x z z