Transformation in 3-D: Transformation in 3-D
3D Transformation: 3D Transformation To represent 3d object we need 3 parameters coordinates which represent width, y coordinates which represent height and z coordinates which represent depth. These 3 axis represent in such way that they are normal to each other. There are two different orientation for z coordinates system. Right handed system Left handed system
3D Translation: 3D Translation Translation of a Point x z y
3D Scaling: 3D Scaling Uniform Scaling x z y
Relative Scaling: Relative Scaling Scaling with a Selected Fixed Position x x x x z z z z y y y y Original position Translate Scaling Inverse Translate
3D Rotation: 3D Rotation Coordinate-Axes Rotations X-axis rotation Y-axis rotation Z-axis rotation General 3D Rotations Rotation about an axis that is parallel to one of the coordinate axes Rotation about an arbitrary axis
3-D Coordinate Spaces: 3-D Coordinate Spaces Remember what we mean by a 3-D coordinate space x axis y axis z axis P y z x Right-Hand Reference System
PowerPoint Presentation: 3D Transformations 2D coordinates 3D coordinates x y x y z x z y Right-handed coordinate system :
Rotations In 3-D: Rotations In 3-D When we performed rotations in two dimensions we only had the choice of rotating about the z axis In the case of three dimensions we have more options Rotate about x – pitch Rotate about y – yaw Rotate about z - roll
PowerPoint Presentation: Yaw, Pitch, and Roll Imagine three lines running through an airplane and intersecting at right angles at the airplane’s centre of gravity. Roll: rotation around the front-to-back axis. Roll: rotation around the side-to-side axis. Roll: rotation around the vertical axis.
Rotation : Rotation Specify- An axis of rotation An angle of rotation is always perpendicular to the axis. A 3d rotation is called canonical rotation when one of the positive x,y,z coordinate axis is choose as the axis of rotation.
Rotating in 3D: Rotating in 3D Rotate about what axis? 3D rotation: about a defined axis Different matrix for: Rotation about x-axis Rotation about y-axis Rotation about z-axis New terminology X-roll: rotation about x-axis Y-roll: rotation about y-axis Z-roll: rotation about z-axis
Rotating in 3D: Rotating in 3D Which way is + ve rotation Look in – ve direction (into + ve arrow) Counter Clock Wise is + ve rotation x y z +
PowerPoint Presentation: An object can rotate along different circular paths centering a given rotation center and thus forming different planes of rotation. We need to fix the plane of rotation and that is done by specifying an axis of rotation instead of a center of rotation. The radius of rotation path is always perpendicular to the axis of rotation. In 3d there are 3 axis there are 3 different plane xy , yz , zx planes. p
Rotating in 3D: Rotating in 3D
Rotation is counterclockwise: Rotation is counterclockwise
PowerPoint Presentation: Rotation about z axis – z coordinates are unchanged because rotation occur perpendicular to the z axis Rotation about other two coordinate axis can be obtained with a cycle permutation of the coordinates parameter x,y,z that is x->y->z->x
Rotation About the X-Axis: Rotation About the X-Axis
PowerPoint Presentation: Rotations, in 3D R=(r x , r y , r z , ) A: We give a vector to rotate about, and a theta that describes how much we rotate.
PowerPoint Presentation: Rotations about the Z axis R=(0,0,1, )
PowerPoint Presentation: Rotations about the X axis R=(1,0,0, ) Let’s look at the other axis rotations
PowerPoint Presentation: Rotations about the Y axis R=(0,1,0, )
Rotations In 3-D: Rotations In 3-D x’ = x · cos θ - y · sin θ y’ = x · sin θ + y · cos θ z’ = z x’ = x y’ = y · cos θ - z · sin θ z’ = y · sin θ + z · cos θ x’ = z · sin θ + x · cos θ y’ = y z’ = z · cos θ - x · sin θ The equations for the three kinds of rotations in 3-D are as follows:
Homogeneous Coordinates In 3-D: Homogeneous Coordinates In 3-D Similar to the 2-D situation we can use homogeneous coordinates for 3-D transformations - 4 coordinate column vector All transformations can then be represented as matrices x axis y axis z axis P y z x P ( x, y, z ) =
Coordinate-Axes Rotations: Coordinate-Axes Rotations Z-Axis Rotation X-Axis Rotation Y-Axis Rotation z y x z y x z y x
Order of Rotations: Order of Rotations Order of Rotation Affects Final Position X-axis Z-axis Z-axis X-axis
General 3D Rotations: General 3D Rotations Rotation about an Axis that is Parallel to One of the Coordinate Axes Translate the object so that the rotation axis coincides with the parallel coordinate axis Perform the specified rotation about that axis Translate the object so that the rotation axis is moved back to its original position
Rotation about an arbitrary axis: Rotation about an arbitrary axis
PowerPoint Presentation: Rotations X Y Z P 2 ( x 2 , y 2 , z 2 ) P 1 ( x 1 , y 1 , z 1 ) We want to rotate an object about an axis in space passing through ( x 1 , y 1 , z 1 ) and ( x 2 , y 2 , z 2 ).
PowerPoint Presentation: Rotating About An Arbitrary Axis Y Z P 2 P 1 1). Translate the object by (- x 1 , - y 1 , - z 1 ): T (- x 1 , - y 1 , - z 1 ) X Y Z P 2 P 1 2). Rotate the axis about x so that it lies on the xz plane: R x ( ) X X Y Z P 2 P 1 3). Rotate the axis about y so that it lies on z : R y ( ) X Y Z P 2 P 1 4). Rotate object about z by : R z ( )
General 3D Rotations: General 3D Rotations Rotation about an Arbitrary Axis Basic Idea Translate (x1, y1, z1) to the origin Rotate (x’2, y’2, z’2) on to the z axis Rotate the object around the z-axis Rotate the axis to the original orientation Translate the rotation axis to the original position (x 2 ,y 2 ,z 2 ) (x 1 ,y 1 ,z 1 ) x z y R -1 T -1 R T
PowerPoint Presentation: Rotating About An Arbitrary Axis Therefore , the mixed matrix that will perform the required task of rotating an object about an arbitrary axis is given by: M = T ( x 1 , y 1 , z 1 ) Rx ( - ) R y (- ) R z ( ) R y ( ) R x ( ) T (- x 1 ,- y 1 ,- z 1 ) Finding is trivial, but about The angle between the z axis and the projection of P 1 P 2 on yz plane is . X Y Z P 2 P 1
General 3D Rotations: General 3D Rotations Step 1. Translation (x 2 ,y 2 ,z 2 ) (x 1 ,y 1 ,z 1 ) x z y
3D Rotation: 3D Rotation To line up the arbitrary rotation axis V with the z-axis, perform two steps: 1. Rotate V about the x-axis so that it is on the x-z plane. 2. Then rotate it about the y-axis so that it lines up with the z-axis. y x z V y x z b a Then, rotating by an arbitrary axis by q is R( q ) = T -1 R -1 x ( a )R -1 y ( b )R z ( q )R y ( b )R x ( a )T
PowerPoint Presentation: Rotating About An Arbitrary Axis X Y Z P 2 P 1
Transformation: Transformation 1 d β y R y is in a similar manner The angle of rotation is determined by the angle that the shadow makes on the z axis. α x
Vector Normalization: Vector Normalization Given a vector v , we want to create a unit vector that has a magnitude of 1 and has the same direction as v . Let’s do an example.
3D Transformation: 3D Transformation Rotation about an arbitrary axis X Y Z O P Axis: P 0 (x 0 , y 0 , z 0 ), ( C x , C y , C z ) Angle: d OP: Unit vector O: (x 0 , y 0 , z 0 ) Translation (-x 0 , -y 0 , -z 0 ) C x C z C y
3D Transformation: 3D Transformation Rotation about an arbitrary axis X Y Z O P Axis: P 0 (x 0 , y 0 , z 0 ), (C x , C y , C z ) Angle: d Rotation about X axis by a C x C z C y a d
3D Transformation: 3D Transformation Rotation about an arbitrary axis X Y Z O Axis: P 0 (x 0 , y 0 , z 0 ), (C x , C y , C z ) Angle: d Rotation about Y axis by b C x d d b 1
3D Transformation: 3D Transformation Rotation about an arbitrary axis Complete Transformation
3D Transformation: 3D Transformation General
General 3D Rotations: General 3D Rotations Step 2- Establish [ T R ] x x axis (a,b,c) (0,b,c) Projected Point Rotated Point x y z b c a (a,b,c) (0,b,c) (0,0,0) (0,0,0) (0,b,c) (0,0,c)
Arbitrary Axis Rotation: Arbitrary Axis Rotation Step 3. Rotate about y axis by (a,b,c) (a,0,d) l d x y Projected Point z Rotated Point a (0,0,0) (a,0,d) d (0,0,d) l
Arbitrary Axis Rotation: Arbitrary Axis Rotation Step 4. Rotate about z axis by the desired angle l y x z
Arbitrary Axis Rotation: Arbitrary Axis Rotation Step 5. Apply the reverse transformation to place the axis back in its initial position x y l l z
Example: Find the new coordinates of a unit cube 90º-rotated about an axis defined by its endpoints A(2,1,0) and B(3,3,1). A Unit Cube Example
PowerPoint Presentation: Step1. Translate point A to the origin A’(0,0,0) x z y B’(1,2,1)
PowerPoint Presentation: x z y l B’(1,2,1) Projected point (0,2,1) B”(1,0, 5 ) Step 2. Rotate axis A ’ B ’ about the x axis by an angle , until it lies on the xz plane.
Example: x z y l B”(1,0, 5) (0,0, 6 ) Example Step 3. Rotate axis A ’ B ’’ about the y axis by and angle , until it coincides with the z axis.
Example: Example Step 4. Rotate the cube 90° about the z axis Finally, the concatenated rotation matrix about the arbitrary axis AB becomes,
Example: Example
Example: Example Multiplying R ( θ ) by the point matrix of the original cube
PowerPoint Presentation: Composition of 3D Rotations In 3D transformations, the order of a sequence of rotations matters!
END: END