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

  1. Linear Transformation: A function that maps vectors to vectors in a linear manner, preserving vector addition and scalar multiplication.
  2. Transformation Matrix: A matrix that represents a linear transformation.
  3. Composition of Transformations: The process of applying multiple transformations in sequence.

  1. 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} \]

  1. Practical Examples

Example 1: Translation followed by Rotation

  1. Translation: Move a point by vector \( \mathbf{t} = (3, 4) \)
  2. 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

  1. Scaling: Scale by a factor of 2
  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} \]

  1. 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.

© Copyright 2024. All rights reserved