In this section, we will explore the concept of composing multiple linear transformations to achieve complex transformations in 3D space. Understanding how to combine transformations is crucial for tasks such as animating objects, applying multiple effects, and manipulating 3D models in computer graphics.
Key Concepts
- Linear Transformation: A function that maps vectors to vectors in a linear manner, preserving vector addition and scalar multiplication.
- Transformation Matrix: A matrix that represents a linear transformation.
- Composition of Transformations: The process of applying multiple transformations in sequence.
- Understanding Composition of Transformations
Definition
The composition of two transformations \( T_1 \) and \( T_2 \) is a new transformation \( T \) such that \( T(\mathbf{v}) = T_2(T_1(\mathbf{v})) \) for any vector \( \mathbf{v} \).
Matrix Representation
If \( T_1 \) is represented by matrix \( A \) and \( T_2 \) is represented by matrix \( B \), then the composition \( T \) is represented by the matrix product \( B \cdot A \).
Order of Multiplication
The order of multiplication matters. \( B \cdot A \) means that \( A \) is applied first, followed by \( B \).
Example
Consider two transformations:
- \( T_1 \): Scaling by a factor of 2, represented by matrix \( A \)
- \( T_2 \): Rotation by 90 degrees, represented by matrix \( B \)
The matrices are:
\[ A = \begin{bmatrix}
2 & 0
0 & 2
\end{bmatrix} \]
\[ B = \begin{bmatrix}
0 & -1
1 & 0
\end{bmatrix} \]
The composition \( T \) is represented by:
\[ T = B \cdot A = \begin{bmatrix}
0 & -1
1 & 0
\end{bmatrix} \cdot \begin{bmatrix}
2 & 0
0 & 2
\end{bmatrix} = \begin{bmatrix}
0 & -2
2 & 0
\end{bmatrix} \]
- Practical Examples
Example 1: Translation followed by Rotation
- Translation: Move a point by vector \( \mathbf{t} = (3, 4) \)
- Rotation: Rotate the point by 45 degrees
Translation matrix \( T \):
\[ T = \begin{bmatrix}
1 & 0 & 3
0 & 1 & 4
0 & 0 & 1
\end{bmatrix} \]
Rotation matrix \( R \):
\[ R = \begin{bmatrix}
\cos(45^\circ) & -\sin(45^\circ) & 0
\sin(45^\circ) & \cos(45^\circ) & 0
0 & 0 & 1
\end{bmatrix} = \begin{bmatrix}
\frac{\sqrt{2}}{2} & -\frac{\sqrt{2}}{2} & 0
\frac{\sqrt{2}}{2} & \frac{\sqrt{2}}{2} & 0
0 & 0 & 1
\end{bmatrix} \]
The composition \( C \) is:
\[ C = R \cdot T = \begin{bmatrix}
\frac{\sqrt{2}}{2} & -\frac{\sqrt{2}}{2} & 0
\frac{\sqrt{2}}{2} & \frac{\sqrt{2}}{2} & 0
0 & 0 & 1
\end{bmatrix} \cdot \begin{bmatrix}
1 & 0 & 3
0 & 1 & 4
0 & 0 & 1
\end{bmatrix} = \begin{bmatrix}
\frac{\sqrt{2}}{2} & -\frac{\sqrt{2}}{2} & -\frac{\sqrt{2}}
\frac{\sqrt{2}}{2} & \frac{\sqrt{2}}{2} & 7\frac{\sqrt{2}}{2}
0 & 0 & 1
\end{bmatrix} \]
Example 2: Scaling followed by Translation
- Scaling: Scale by a factor of 2
- Translation: Move by vector \( \mathbf{t} = (1, 2) \)
Scaling matrix \( S \):
\[ S = \begin{bmatrix}
2 & 0 & 0
0 & 2 & 0
0 & 0 & 1
\end{bmatrix} \]
Translation matrix \( T \):
\[ T = \begin{bmatrix}
1 & 0 & 1
0 & 1 & 2
0 & 0 & 1
\end{bmatrix} \]
The composition \( C \) is:
\[ C = T \cdot S = \begin{bmatrix}
1 & 0 & 1
0 & 1 & 2
0 & 0 & 1
\end{bmatrix} \cdot \begin{bmatrix}
2 & 0 & 0
0 & 2 & 0
0 & 0 & 1
\end{bmatrix} = \begin{bmatrix}
2 & 0 & 1
0 & 2 & 2
0 & 0 & 1
\end{bmatrix} \]
- Exercises
Exercise 1: Composition of Rotations
Given two rotation matrices:
\[ R_1 = \begin{bmatrix}
\cos(30^\circ) & -\sin(30^\circ) & 0
\sin(30^\circ) & \cos(30^\circ) & 0
0 & 0 & 1
\end{bmatrix} \]
\[ R_2 = \begin{bmatrix}
\cos(60^\circ) & -\sin(60^\circ) & 0
\sin(60^\circ) & \cos(60^\circ) & 0
0 & 0 & 1
\end{bmatrix} \]
Find the composition \( R = R_2 \cdot R_1 \).
Solution
\[ R = \begin{bmatrix}
\cos(60^\circ) & -\sin(60^\circ) & 0
\sin(60^\circ) & \cos(60^\circ) & 0
0 & 0 & 1
\end{bmatrix} \cdot \begin{bmatrix}
\cos(30^\circ) & -\sin(30^\circ) & 0
\sin(30^\circ) & \cos(30^\circ) & 0
0 & 0 & 1
\end{bmatrix} \]
\[ R = \begin{bmatrix}
\frac{1}{2} & -\frac{\sqrt{3}}{2} & 0
\frac{\sqrt{3}}{2} & \frac{1}{2} & 0
0 & 0 & 1
\end{bmatrix} \cdot \begin{bmatrix}
\frac{\sqrt{3}}{2} & -\frac{1}{2} & 0
\frac{1}{2} & \frac{\sqrt{3}}{2} & 0
0 & 0 & 1
\end{bmatrix} \]
\[ R = \begin{bmatrix}
\frac{1}{2} \cdot \frac{\sqrt{3}}{2} + -\frac{\sqrt{3}}{2} \cdot \frac{1}{2} & \frac{1}{2} \cdot -\frac{1}{2} + -\frac{\sqrt{3}}{2} \cdot \frac{\sqrt{3}}{2} & 0
\frac{\sqrt{3}}{2} \cdot \frac{\sqrt{3}}{2} + \frac{1}{2} \cdot \frac{1}{2} & \frac{\sqrt{3}}{2} \cdot -\frac{1}{2} + \frac{1}{2} \cdot \frac{\sqrt{3}}{2} & 0
0 & 0 & 1
\end{bmatrix} \]
\[ R = \begin{bmatrix}
\frac{3}{4} - \frac{1}{4} & -\frac{1}{4} - \frac{3}{4} & 0
\frac{3}{4} + \frac{1}{4} & -\frac{\sqrt{3}}{4} + \frac{\sqrt{3}}{4} & 0
0 & 0 & 1
\end{bmatrix} \]
\[ R = \begin{bmatrix}
\frac{1}{2} & -1 & 0
1 & 0 & 0
0 & 0 & 1
\end{bmatrix} \]
Exercise 2: Scaling and Rotation
Given a scaling matrix \( S \) and a rotation matrix \( R \):
\[ S = \begin{bmatrix}
3 & 0 & 0
0 & 3 & 0
0 & 0 & 1
\end{bmatrix} \]
\[ R = \begin{bmatrix}
\cos(45^\circ) & -\sin(45^\circ) & 0
\sin(45^\circ) & \cos(45^\circ) & 0
0 & 0 & 1
\end{bmatrix} \]
Find the composition \( C = R \cdot S \).
Solution
\[ C = \begin{bmatrix}
\frac{\sqrt{2}}{2} & -\frac{\sqrt{2}}{2} & 0
\frac{\sqrt{2}}{2} & \frac{\sqrt{2}}{2} & 0
0 & 0 & 1
\end{bmatrix} \cdot \begin{bmatrix}
3 & 0 & 0
0 & 3 & 0
0 & 0 & 1
\end{bmatrix} \]
\[ C = \begin{bmatrix}
\frac{\sqrt{2}}{2} \cdot 3 & -\frac{\sqrt{2}}{2} \cdot 3 & 0
\frac{\sqrt{2}}{2} \cdot 3 & \frac{\sqrt{2}}{2} \cdot 3 & 0
0 & 0 & 1
\end{bmatrix} \]
\[ C = \begin{bmatrix}
\frac{3\sqrt{2}}{2} & -\frac{3\sqrt{2}}{2} & 0
\frac{3\sqrt{2}}{2} & \frac{3\sqrt{2}}{2} & 0
0 & 0 & 1
\end{bmatrix} \]
Conclusion
In this section, we have learned about the composition of transformations, which is essential for combining multiple linear transformations into a single operation. We explored the matrix representation of composed transformations and worked through practical examples to solidify our understanding. By mastering these concepts, you will be able to manipulate 3D objects more effectively in various applications, including computer graphics and animation.
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