III 3 D Transformation Homogeneous Coordinates • The three dimensional point (x, y, z) is represented by the homogeneous coordinate (x, y, z, 1) • In general, the homogeneous coordinate (x, y, z, w) represents the three dimensional point (x/w, y/w, z/w) • The generalized transformation matrix: 1
Scaling • In general, this is done with the equations: xn = sx * x yn = sy * y zn = sz * z • This can also be done with the matrix multiplication: 2
• Scaling can be done relative to the object center with a composite transformation • Scaling an object centered at (cx, cy, cz) is done with the matrix multiplication: 3
Shearing • Equivalent to pulling faces in opposite directions • 4
5
6
7
8
Rotation • Rotation can be done around any line or vector • Rotations are commonly specified around the x, y, or z axis • A positive angle of rotation results in a counterclockwise movement when looked at from the positive axis direction • The matrix form for rotation – x axis 9
– y axis – z axis 10
11
12
13
Reflection • Reflection through the xy-plane: • Reflection through the yz-plane: • Reflection through the xz-plane: 14
15
16
Translations • The amount of the translation is added to or subtracted from the x, y, and z coordinates • In general, this is done with the equations: xn = x + tx yn = y + ty zn = z + tz • This can also be done with the matrix multiplication: 17
18
19
20
21
22
Combining Transformations • Matrices can be multiplied together to accomplish multiple transformations with one matrix • A matrix is built with successive transformations occurring from right to left • A combination matrix is typically built from the identity matrix with each new transformation added by multiplying it on the left of the current combination 23
Rotation about an Arbitrary Axis in Space • Assume an arbitrary axis in space passing through the point with direction cosines and rotation about this axis by some angle • 24