3D transformations: 3D transformations
PowerPoint Presentation: Any point on a 3D object is represented by 3 co-ordinates x, y , z where z is usually refers to the depth. Basic 3D transformations are Translation Rotation scaling
Translation : Translation Consider a point P(x, y, z) in 3D. If we want to move a new location P’(x’, y’, z’) . We have to add translation distances as follows. x’ = x+t x y’= y+t y z’= z+t z
PowerPoint Presentation: Translation Matrix z’ = z +t z
In terms of homogeneous coordinates the matrix representation is as follows: In terms of homogeneous coordinates the matrix representation is as follows
Scaling : Scaling The coordinate transformation for scaling relating to the origin are x’ = x. S x y’= y. S y z’= z. S z Where S x, S y, S z are scaling factors.
In terms of homogeneous coordinates the matrix representation is as follows: In terms of homogeneous coordinates the matrix representation is as follows
PowerPoint Presentation: Scaling of an object changes the size of an object and reposition the object relating to the coordinate origin. If the scaling are not all equal, relative directions in the object are changed. The original shape of an object can be preserved with a uniform scaling S x = S y = S z
Scaling w. r .t a fixed point(xf , yf, zf): Scaling w. r .t a fixed point(x f , y f , z f ) This can be accomplished with the following transformations. Translate the fixed point to the origin. Scale the object relative to the coordinate origin. Translate the fixed point back to the original position.
The matrix representation for an arbitrary fixed point scaling can be expressed as the concatenation of translate-scale-translate transformations as : The matrix representation for an arbitrary fixed point scaling can be expressed as the concatenation of translate-scale-translate transformations as
PowerPoint Presentation: x' = X . S x + x f (1-S x ) Y' = Y . S y + Y f (1-S y ) Z' = Z . S z + Z f (1-S z )
Rotation : Rotation Rotation about X axis. Rotation about Y axis Rotation about Z axis
Rotation about X axis: Rotation about X axis P P' y' y r r Ø Ѳ Ø - Ѳ z z' y z x
PowerPoint Presentation: Where is the angle between P and P’. Ø is the angle between P and horizontal axis. (Ø- Ѳ ) is the angle between P’ and horizontal axis z. Ѳ
PowerPoint Presentation: sin Ø = opp / hyp = y/r Y= r.sin Ø Cos Ø = adj / hyp = z / r z= r. Cos Ø 1 2
PowerPoint Presentation: Cos (Ø- Ѳ ) = z’ /r z’ = r.cos(Ø - Ѳ ) // cos(A-B)= cos A cos B + sin A sin B z’ = r.[Cos ØCos Ѳ + Sin ØSin Ѳ ] z’ = r . Cos Ѳ Cos Ø + r. Sin Ѳ Sin Ø substitute eqns 1 & 2 in eqn 3 z’= z. Cos Ѳ + y . sin Ѳ 3 A
PowerPoint Presentation: sin (Ø- Ѳ ) = y’ /r y’ = r.sin(Ø- Ѳ ) // sin(A-B)=sin A cos B - cos A sin B y’ = r[ SinØ Cos Ѳ - CosØ Sin Ѳ ] y’ = r. SinØ Cos Ѳ - r. CosØ Sin Ѳ substitute eqns 1 & 2 in eqn 4 y’= y. Cos Ѳ - z. sin Ѳ 4 B
PowerPoint Presentation: x‘ = x y’= y. Cos Ѳ - z. sin Ѳ z’= z. Cos Ѳ + y . sin Ѳ
Rotation about Y axis: Rotation about Y axis P P' z' z r r Ø Ѳ Ø - Ѳ x x' z x y
PowerPoint Presentation: sin Ø = opp / hyp = z/r z= r.sin Ø Cos Ø = adj / hyp = x / r X= r. Cos Ø 1 2
PowerPoint Presentation: Cos (Ø- Ѳ ) = X’ /r X’ = r.cos(Ø- Ѳ ) // cos(A-B)= cos A cos B + sin A sin B X’ = r.[Cos Ø Cos Ѳ + Sin Ø Sin Ѳ ] X’ = r . Cos Ø Cos Ѳ + r. Sin Ø Sin Ѳ substitute eqns 1 & 2 in eqn 3 X’= x. Cos Ѳ + z . sin Ѳ 3 A
PowerPoint Presentation: sin (Ø- Ѳ ) = z’ /r z’ = r.sin(Ø- Ѳ ) // sin(A-B)=sin A cos B - cos A sin B z’ = r[Sin Ø Cos Ѳ - Cos Ø Sin Ѳ ] z’ = r. Sin Ø Cos Ѳ - r. Cos Ø Sin Ѳ substitute eqns 1 & 2 in eqn 4 z’= z. Cos Ѳ - x. sin Ѳ 4 B
PowerPoint Presentation: x‘ = z. Sin Ѳ + x . Cos Ѳ y’=y z’=z. Cos Ѳ - x. Sin Ѳ
Rotation about z axis: Rotation about z axis P P' x' x r r Ø Ѳ Ø - Ѳ y y' x y z
PowerPoint Presentation: sin Ø = opp / hyp = x/r x= r.sin Ø Cos Ø = adj / hyp = y / r y= r. Cos Ø 1 2
PowerPoint Presentation: Cos (Ø- Ѳ ) = y’ /r y’ = r.cos(Ø- Ѳ ) // cos(A-B)= cos A cos B + sin A sin B y’ = r.[Cos ØCos Ѳ + Sin Ø Sin Ѳ ] y’ = r . Cos Ø Cos Ѳ + r. Sin Ø Sin Ѳ substitute eqns 1 & 2 in eqn 3 y’= x. sin Ѳ + y . Cos Ѳ 3 A
PowerPoint Presentation: sin (Ø- Ѳ ) = x’ /r x’ = r.sin(Ø- Ѳ ) // sin(A-B)=sin A cos B - cos A sin B x’ = r[ SinØ Cos Ѳ - CosØ Sin Ѳ ] x’ = r. Sin Ѳ Cos Ø - r. CosØ Sin Ѳ substitute eqns 1 & 2 in eqn 4 x’= x. Cos Ѳ - y. sin Ѳ 4 B
PowerPoint Presentation: x‘ = x. Cos Ѳ - y. sin Ѳ y’= x. sin Ѳ + y . Cos Ѳ z’= z