In this section, we will explore three fundamental types of linear transformations in 3D space: rotations, translations, and scalings. These transformations are essential for manipulating objects in 3D graphics and are widely used in computer graphics, animation, and various simulations.
- Rotations
Definition
Rotation is a transformation that turns every point of an object around a fixed axis by a certain angle. In 3D space, rotations can be more complex than in 2D because they can occur around any of the three principal axes (x, y, z) or any arbitrary axis.
Rotation Matrices
The rotation of a point in 3D space can be represented using rotation matrices. Here are the rotation matrices for rotating around the principal axes:
- Rotation around the x-axis by an angle θ:
\[ R_x(\theta) = \begin{bmatrix}
1 & 0 & 0
0 & \cos\theta & -\sin\theta
0 & \sin\theta & \cos\theta
\end{bmatrix} \]
- Rotation around the y-axis by an angle θ:
\[ R_y(\theta) = \begin{bmatrix}
\cos\theta & 0 & \sin\theta
0 & 1 & 0
-\sin\theta & 0 & \cos\theta
\end{bmatrix} \]
- Rotation around the z-axis by an angle θ:
\[ R_z(\theta) = \begin{bmatrix}
\cos\theta & -\sin\theta & 0
\sin\theta & \cos\theta & 0
0 & 0 & 1
\end{bmatrix} \]
Example
To rotate a point \( P = (x, y, z) \) around the z-axis by 90 degrees (π/2 radians):
\[ R_z\left(\frac{\pi}{2}\right) = \begin{bmatrix}
0 & -1 & 0
1 & 0 & 0
0 & 0 & 1
\end{bmatrix} \]
\[ P' = R_z\left(\frac{\pi}{2}\right) \cdot \begin{bmatrix}
x
y
z
\end{bmatrix} = \begin{bmatrix}
0 & -1 & 0
1 & 0 & 0
0 & 0 & 1
\end{bmatrix} \cdot \begin{bmatrix}
x
y
z
\end{bmatrix} = \begin{bmatrix}
-y
x
z
\end{bmatrix} \]
- Translations
Definition
Translation is a transformation that moves every point of an object by the same distance in a given direction. It is represented by adding a translation vector to the coordinates of each point.
Translation Matrix
In homogeneous coordinates, translation can be represented using a 4x4 matrix:
\[ T(tx, ty, tz) = \begin{bmatrix}
1 & 0 & 0 & tx
0 & 1 & 0 & ty
0 & 0 & 1 & tz
0 & 0 & 0 & 1
\end{bmatrix} \]
Example
To translate a point \( P = (x, y, z) \) by \( (tx, ty, tz) \):
\[ T(tx, ty, tz) = \begin{bmatrix}
1 & 0 & 0 & tx
0 & 1 & 0 & ty
0 & 0 & 1 & tz
0 & 0 & 0 & 1
\end{bmatrix} \]
\[ P' = T(tx, ty, tz) \cdot \begin{bmatrix}
x
y
z
1
\end{bmatrix} = \begin{bmatrix}
1 & 0 & 0 & tx
0 & 1 & 0 & ty
0 & 0 & 1 & tz
0 & 0 & 0 & 1
\end{bmatrix} \cdot \begin{bmatrix}
x
y
z
1
\end{bmatrix} = \begin{bmatrix}
x + tx
y + ty
z + tz
1
\end{bmatrix} \]
- Scalings
Definition
Scaling is a transformation that enlarges or diminishes objects. It is defined by scaling factors along the x, y, and z axes.
Scaling Matrix
The scaling transformation can be represented using a 4x4 matrix in homogeneous coordinates:
\[ S(sx, sy, sz) = \begin{bmatrix}
sx & 0 & 0 & 0
0 & sy & 0 & 0
0 & 0 & sz & 0
0 & 0 & 0 & 1
\end{bmatrix} \]
Example
To scale a point \( P = (x, y, z) \) by \( (sx, sy, sz) \):
\[ S(sx, sy, sz) = \begin{bmatrix}
sx & 0 & 0 & 0
0 & sy & 0 & 0
0 & 0 & sz & 0
0 & 0 & 0 & 1
\end{bmatrix} \]
\[ P' = S(sx, sy, sz) \cdot \begin{bmatrix}
x
y
z
1
\end{bmatrix} = \begin{bmatrix}
sx & 0 & 0 & 0
0 & sy & 0 & 0
0 & 0 & sz & 0
0 & 0 & 0 & 1
\end{bmatrix} \cdot \begin{bmatrix}
x
y
z
1
\end{bmatrix} = \begin{bmatrix}
sx \cdot x
sy \cdot y
sz \cdot z
1
\end{bmatrix} \]
Practical Exercises
Exercise 1: Rotation
Rotate the point \( P = (1, 2, 3) \) around the y-axis by 45 degrees.
Solution:
\[ R_y\left(\frac{\pi}{4}\right) = \begin{bmatrix}
\frac{\sqrt{2}}{2} & 0 & \frac{\sqrt{2}}{2}
0 & 1 & 0
-\frac{\sqrt{2}}{2} & 0 & \frac{\sqrt{2}}{2}
\end{bmatrix} \]
\[ P' = R_y\left(\frac{\pi}{4}\right) \cdot \begin{bmatrix}
1
2
3
\end{bmatrix} = \begin{bmatrix}
\frac{\sqrt{2}}{2} & 0 & \frac{\sqrt{2}}{2}
0 & 1 & 0
-\frac{\sqrt{2}}{2} & 0 & \frac{\sqrt{2}}{2}
\end{bmatrix} \cdot \begin{bmatrix}
1
2
3
\end{bmatrix} = \begin{bmatrix}
2.828
2
1.414
\end{bmatrix} \]
Exercise 2: Translation
Translate the point \( P = (4, -3, 2) \) by \( (1, 2, -1) \).
Solution:
\[ T(1, 2, -1) = \begin{bmatrix}
1 & 0 & 0 & 1
0 & 1 & 0 & 2
0 & 0 & 1 & -1
0 & 0 & 0 & 1
\end{bmatrix} \]
\[ P' = T(1, 2, -1) \cdot \begin{bmatrix}
4
-3
2
1
\end{bmatrix} = \begin{bmatrix}
1 & 0 & 0 & 1
0 & 1 & 0 & 2
0 & 0 & 1 & -1
0 & 0 & 0 & 1
\end{bmatrix} \cdot \begin{bmatrix}
4
-3
2
1
\end{bmatrix} = \begin{bmatrix}
5
-1
1
1
\end{bmatrix} \]
Exercise 3: Scaling
Scale the point \( P = (2, 3, 4) \) by \( (2, 0.5, 3) \).
Solution:
\[ S(2, 0.5, 3) = \begin{bmatrix}
2 & 0 & 0 & 0
0 & 0.5 & 0 & 0
0 & 0 & 3 & 0
0 & 0 & 0 & 1
\end{bmatrix} \]
\[ P' = S(2, 0.5, 3) \cdot \begin{bmatrix}
2
3
4
1
\end{bmatrix} = \begin{bmatrix}
2 & 0 & 0 & 0
0 & 0.5 & 0 & 0
0 & 0 & 3 & 0
0 & 0 & 0 & 1
\end{bmatrix} \cdot \begin{bmatrix}
2
3
4
1
\end{bmatrix} = \begin{bmatrix}
4
1.5
12
1
\end{bmatrix} \]
Conclusion
In this section, we have learned about three fundamental transformations in 3D space: rotations, translations, and scalings. We have explored their mathematical representations using matrices and provided practical examples and exercises to reinforce the concepts. Understanding these transformations is crucial for manipulating 3D objects in various applications, including computer graphics, animation, and simulations.
Mathematics 3D
Module 1: Fundamentals of Linear Algebra
- Vectors and Vector Spaces
- Matrices and Determinants
- Systems of Linear Equations
- Eigenvalues and Eigenvectors
Module 2: Linear Transformations
- Definition and Properties
- Transformation Matrices
- Rotations, Translations, and Scalings
- Composition of Transformations
Module 3: Geometry in 3D Space
- Coordinates and Planes
- Vectors in 3D Space
- Dot Product and Cross Product
- Equations of Planes and Lines