Procedure is similar as in the case of two-dimensional geometric transformations.
Translation can best be described as linear change in position. This change can be represented by a delta vector [dx, dy, dz], where dx represents the change in the object's x position, dy represents the change in its y position, and dz its z position.
Translation is defined by a delta vector v = (Tx, Ty, Tz) and by a transformation matrix
| 1 0 0 0 |
| 0 1 0 0 |
Ap = | 0 0 1 0 |
|Tx Ty Tz 1 |
Example :
Point with coordinates (x, y, z) will be shifted
by vector v = (Tx, Ty, Tz).
| 1 0 0 0 | | x y z 1 |* | 0 1 0 0 | = | x+Tx y+Ty z+Tz 1 | | 0 0 1 0 | | Tx Ty Tz 1 |
Rotation of an object in space is done by means of rotation around coordinate axes.
Transformation matrix of rotation about the x axis by angle u :
| 1 0 0 0 |
| 0 cos u sin u 0 |
Ax = | 0 -sin u cos u 0 |
| 0 0 0 1 |
Transformation matrix of rotation about the y axis by angle u :
| cos u 0 sin u 0 | | 0 1 0 0 | Ay = | -sin u 0 cos u 0 | | 0 0 0 1 |
Transformation matrix of rotation about the z axis by angle u :
| cos u sin u 0 0 | |-sin u cos u 0 0 | Az =| 0 0 1 0 | | 0 0 0 1 |
Example of rotation:
Let's take point (X, Y, Z) to rotate about the point (0, 0, 0)
1. The 2D rotation about the x axis by angle u
X' = X Y' = Y * cos(u) - Z * sin(u) Z' = Y * sin(u) + Z *cos(u)
2. rotate about the y axis by angle u
X' = X * cos(u) + Z * sin(u) Y' = Y Z' = Z *cos(u) - X * sin(u)
3. rotate about the z axis by angle u
X' = X * cos(u) - Y * sin(u) Y' = Y *cos(u)+-X * sin(u) Z' = Z
Finally, result coordinate of point are (X', Y', Z').
Scale change - scaling in space is represented by the following transformation matrix:
where coefficients Sx, Sy and Sz determine scale point of the coordinate axis.| Sx 1 0 0 | | 1 Sy 0 0 | As = | 0 0 Sz 0 | , | 0 0 0 1 |
Example : Vector (x, y, z, 1) is to be magnified to (x*Sx, y*Sy, z*Sz, 1)
The vector will be multiplied by the transformation matrix :
| sx 0 0 0 | | x y z 1 | * | 0 sy 0 0 | = |x*sx y*sy z*sz 1| | 0 0 sz 0 | | 0 0 0 1 |
Like in surface, in space symetry is a special case of scale change, where values of Sx, Sy and Sz are either 1 or -1.
|
|
|
|
|
| symetry by x axis |
|
|
|
| symetry by y axis |
|
|
|
| symetry by z axis |
|
|
|
| symetry by xy plane |
|
|
|
| symetry by plane xy |
|
|
|
| symetry by plane xy |
|
|
|
| symetry by center |
|
|
|
In space, we divide shear transformation according to the direction of the surfaces xy,xz and yz. Values of Sx,Sy and Sz determine shear transformation sizes for all the directions.
A shear transformation about the xy plane
| 1 0 0 0 | | 0 1 0 0 | Axy = | Sx Sy 0 0 |. | 0 0 0 1 |
A shear matrix about the xz plane
| 1 0 0 0 | | Sx 1 Sz 0 | Axz = | 0 1 1 0 |. | 0 0 0 1 |
A shear matrix about the yz plane
| 1 Sy Sz 0 | | 0 1 0 0 | Ayz = | 0 0 1 0 |. | 0 0 0 1 |