240 likes | 541 Views
3 D Transformations. Dr. Aree Ali Mohammed Assistant Professor 2014-2015 3 rd Stage aree.ali@univsul.edu.iq. y. x. z (out of page). Introduction. Use homogeneous coordinates, just as in 2D case. Transformations are now 4x4 matrices.
E N D
3D Transformations Dr. Aree Ali Mohammed Assistant Professor 2014-2015 3rd Stage aree.ali@univsul.edu.iq University of Sulaimani - School of Science - Computer Dept.
y x z (out of page) Introduction • Use homogeneous coordinates, just as in 2D case. • Transformations are now 4x4 matrices. • We will use a right-handed (world) coordinate system - ( z out of page ).
3D Coordinate Systems • Left Hand coordinate system: • Right Handcoordinate system:
Translation in 3D Simple extension to the 2D case: Lecture 4
Original scale Y axis scale all axes Scale in 3D
Rotation in 3D • Need to specify which axis the rotation is about. • z-axis rotation is the same as the 2D case.
Rotation about Arbitrary Axis In special case where an object is to be rotated about an axis that is parallel to one of the coordinate axes we can obtain the resultant coordinates with the following transformation sequence. 1. Translate the object so that the rotation axis coincides with the parallel coordinate axis. 2. Perform the specified rotation about that axis. 3. Translate the object so that the rotation axis is moved back to its original position. University of Sulaimani - School of Science - Computer Dept.
Rotation about Arbitrary Axis Axis not parallel University of Sulaimani - School of Science - Computer Dept.
Rotate(k, θ) Rotation about an arbitrary axis y θ u • About (ux, uy, uz), a unit vector on an arbitrary axis x z uxux(1-c)+c uyux(1-c)+uzs uzux(1-c)-uys 0 uzux(1-c)-uzs uzux(1-c)+c uyuz(1-c)+uxs 0 uxuz(1-c)+uys uyuz(1-c)-uxs uzuz(1-c)+c 0 0 0 0 1 x y z 1 x' y' z' 1 = where c = cos θ & s = sin θ
An arbitrary axis(with the rotation axis projected onto theZaxis):
Reflection with Respect to Given Plane • Respect to xy plane Consider point P(x,y,z). The reflection of this point with respect to xy plane is given by point P’(x,y,-z). 0 0 0 1 0 0 0 -1 M= University of Sulaimani - School of Science - Computer Dept.
Reflection with Respect to any Plane • Respect to any plane x=0 (yz plane) y=0 (xz plane) z=0 (xy plane) 1. Translate a known point P˳, that lies in the reflection plane to the origin of the co-ordinate system. 2. Rotate the normal vector of the reflection plane at the origin until it is coincident with +ve z axis, this makes the reflection plane z=0 co-ordinate plane i.e. xy plane. 3. Reflect the object through z=0 (xy plane) co-ordinate plane. 4. Perform the inverse transformation to those given above to achieve the result. University of Sulaimani - School of Science - Computer Dept.
Reflection any Plane University of Sulaimani - School of Science - Computer Dept.
Reflection - Example Find the matrix for mirror reflection with respect to the plane passing through the origin and having a normal vector whose direction is Sol: Translation matrix is not necessary University of Sulaimani - School of Science - Computer Dept.
y x z Shear along Z-axis University of Sulaimani - School of Science - Computer Dept.
Example • Transform the given position vector [ 3 2 1 1] • by the following sequence of operations • (i) Translate by –1, -1, -1 in x, y, and z respectively • (ii) Rotate by +30°about x-axis and +45°about y axis
Review Questions • Give a 3x3 homogeneous coordinate transformation matrix for each of the following translations. • Shift the image to the right 3-units. • Shift the image up 2-units. • Move the image down ½ unit and left 4-units. 2. Prove that the transformation matrix for the reflection about the line Y=X is: University of Sulaimani - School of Science - Computer Dept.