3 D Transformation Transformation A transformation is an

  • Slides: 29
Download presentation
3 D Transformation

3 D Transformation

Transformation • A transformation is an operation that transforms or changes a shape. •

Transformation • A transformation is an operation that transforms or changes a shape. • There are several basic ways you can change a shape: – Translation (moving it) – Rotation (turning it round) – Scaling (making it bigger or smaller). – Shear (changing the main shape). – Reflection (mirroring the shape about axis). • Transforming an object means transforming all of its points Anil Verma, IOE Pulchowk

3 D Transformation • • Same as 2 D. Add z-axis and z-coordinate. Use

3 D Transformation • • Same as 2 D. Add z-axis and z-coordinate. Use 4 X 4 homogenous matrix. In part I, we discussed translation, rotation and scaling. Anil Verma, IOE Pulchowk

3 D Translation Anil Verma, IOE Pulchowk

3 D Translation Anil Verma, IOE Pulchowk

3 D Scaling (relative to the origin point) • x, y and z values

3 D Scaling (relative to the origin point) • x, y and z values multiplied by scaling factors sx, sy and sz Anil Verma, IOE Pulchowk

3 D Scaling (relative to the origin point) Anil Verma, IOE Pulchowk

3 D Scaling (relative to the origin point) Anil Verma, IOE Pulchowk

3 D Scaling (relative to fixed point) Fixed point Anil Verma, IOE Pulchowk

3 D Scaling (relative to fixed point) Fixed point Anil Verma, IOE Pulchowk

3 D Scaling (relative to fixed point) • Scaling with a Selected Fixed Position

3 D Scaling (relative to fixed point) • Scaling with a Selected Fixed Position y z y x Original position y x z Translate y x z Scaling Anil Verma, IOE Pulchowk z x Inverse Translate

3 D Scaling (relative to fixed point) • for general scaling (relative to fixed

3 D Scaling (relative to fixed point) • for general scaling (relative to fixed point F) • where Anil Verma, IOE Pulchowk

3 D Rotation • Coordinate-Axes Rotations – X-axis rotation – Y-axis rotation – Z-axis

3 D Rotation • Coordinate-Axes Rotations – X-axis rotation – Y-axis rotation – Z-axis rotation • General 3 D Rotations – Rotation about an axis that is parallel to one of the coordinate axes – Rotation about an arbitrary axis Anil Verma, IOE Pulchowk

3 D Rotation – (z-axis) • Rotating around the z axis: Anil Verma, IOE

3 D Rotation – (z-axis) • Rotating around the z axis: Anil Verma, IOE Pulchowk

3 D Rotation – (x-axis) • Rotation around the X axis: Anil Verma, IOE

3 D Rotation – (x-axis) • Rotation around the X axis: Anil Verma, IOE Pulchowk

3 D Rotation – (y-axis) • Rotation around the Y axis: Anil Verma, IOE

3 D Rotation – (y-axis) • Rotation around the Y axis: Anil Verma, IOE Pulchowk

General 3 D Rotations • Rotation about an Axis that is Parallel to One

General 3 D 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 Anil Verma, IOE Pulchowk

General 3 D Rotations • Rotation about an Arbitrary Axis Basic Idea y T

General 3 D Rotations • Rotation about an Arbitrary Axis Basic Idea y T (x 2, y 2, z 2) R (x 1, y 1, z 1) R-1 x T-1 1. Translate (x 1, y 1, z 1) to the origin 2. Rotate (x’ 2, y’ 2, z’ 2) on to the z axis 3. Rotate the object around the z-axis 4. Rotate the axis to the original orientation 5. Translate the rotation axis to the original position z Anil Verma, IOE Pulchowk

Arbitrary Axis Rotation • Step 1. Translation y (x 2, y 2, z 2)

Arbitrary Axis Rotation • Step 1. Translation y (x 2, y 2, z 2) (x 1, y 1, z 1) x z Anil Verma, IOE Pulchowk

Arbitrary Axis Rotation • Step 2. Establish [ TR ] x x axis y

Arbitrary Axis Rotation • Step 2. Establish [ TR ] x x axis y (0, b, c) Projected Point (a, b, c) x z Rotated Point Anil Verma, IOE Pulchowk

Arbitrary Axis Rotation • Step 3. Rotate about y axis by y (a, b,

Arbitrary Axis Rotation • Step 3. Rotate about y axis by y (a, b, c) Projected Point l d x (a, 0, d) z Rotated Point Anil Verma, IOE Pulchowk

Arbitrary Axis Rotation • Step 4. Rotate about z axis by the desired angle

Arbitrary Axis Rotation • Step 4. Rotate about z axis by the desired angle y l x z Anil Verma, IOE Pulchowk

Arbitrary Axis Rotation • Step 5. Apply the reverse transformation to place the axis

Arbitrary Axis Rotation • Step 5. Apply the reverse transformation to place the axis back in its initial position y l l x z Anil Verma, IOE Pulchowk

Example Ex) Find the new coordinates of a unit cube 90º-rotated about an axis

Example Ex) 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 Anil Verma, IOE Pulchowk

Example • Step 1. Translate point A to the origin y B’(1, 2, 1)

Example • Step 1. Translate point A to the origin y B’(1, 2, 1) A’(0, 0, 0) x z Anil Verma, IOE Pulchowk

Example • Step 2. Rotate axis A’B’ about the x axis by and angle

Example • Step 2. Rotate axis A’B’ about the x axis by and angle , until it lies on the xz plane. y Projected point (0, 2, 1) z B’(1, 2, 1) l x B”(1, 0, 5) Anil Verma, IOE Pulchowk

Example • Step 3. Rotate axis A’B’’ about the y axis by and angle

Example • Step 3. Rotate axis A’B’’ about the y axis by and angle , until it coincides with the z axis. y (0, 0, 6) l x B”(1, 0, 5) z Anil Verma, IOE Pulchowk

Example • Step 4. Rotate the cube 90° about the z axis Finally, the

Example • Step 4. Rotate the cube 90° about the z axis Finally, the concatenated rotation matrix about the arbitrary axis AB becomes, Anil Verma, IOE Pulchowk

Example Anil Verma, IOE Pulchowk

Example Anil Verma, IOE Pulchowk

Example • Multiplying [TR]AB by the point matrix of the original cube Anil Verma,

Example • Multiplying [TR]AB by the point matrix of the original cube Anil Verma, IOE Pulchowk

3 D Reflection • Reflection Relative to the xy Plane y y z z

3 D Reflection • Reflection Relative to the xy Plane y y z z x x • [Do also Reflection Relative to the yz, zx Plane. . . ] Anil Verma, IOE Pulchowk

3 D Shear • Z-axis shear • Where a and b are the shear

3 D Shear • Z-axis shear • Where a and b are the shear factors for x and y respectively. • Do, X-axis and Y-axis shear. Anil Verma, IOE Pulchowk