Geometric Transformations

Geometric transformations are an example of a mapping used to manipulate vectors in space. They are typically used to do things like rotate, scale, and translate vectors across the space they occupy. Geometric transformations come up frequently in computer graphics, as well as physics and other branches of math.

We will first take a look at rotations to see how we can derive a function that rotates a vector by an angle \theta. To start, let’s take a look at what a rotation does in \mathbb{R}^2 space.

In the x-direction, we can represent our rotated coordinate as: \begin{bmatrix} cos(\theta) \\ sin(\theta) \end{bmatrix}. Similarly, in the y-direction, we can represent our rotated coordinate as: \begin{bmatrix} -sin(\theta) \\ cos(\theta) \end{bmatrix}. If we combine the two components, we will get a matrix that will rotate any vector. This means that our rotation function can be written as:

R_{\theta}(\vec{x}) = \begin{bmatrix} cos(\theta) & -sin(\theta) \\ sin(\theta) & cos(\theta) \end{bmatrix}\vec{x}

Example: Rotate the vector \begin{bmatrix} 1 \\ 1 \end{bmatrix} with \theta = \frac{\pi}{4}

To do this, we apply the same idea as our matrix mappings. We substitute theta into our rotation matrix, and multiply it by the vector we want to rotate. Doing so gives us the following:

R_{\frac{\pi}{4}}(\begin{bmatrix} 1 \\ 1 \end{bmatrix}) =  \begin{bmatrix} cos(\frac{\pi}{4}} & - sin(\frac{\pi}{4}) \\  sin(\frac{\pi}{4}) & cos(\frac{\pi}{4}) \end{bmatrix}  \begin{bmatrix} 1 \\ 1 \end{bmatrix} = \begin{bmatrix}   cos(\frac{\pi}{4}) - sin(\frac{\pi}{4}) \\ sin(\frac{\pi}{4}) +   cos(\frac{\pi}{4})\end{bmatrix}

We can further extend the idea of rotations into \mathbb{R}^3 space by slightly modifying the rotational matrix to account for the extra dimension. In \mathbb{R}^3, the rotational matrix is defined as follows:

R_{\theta}(\vec{x}) = \begin{bmatrix} cos(\theta) & -sin(\theta) & 0 \\ sin(\theta) & cos(\theta) & 0 \\ 0 & 0 & 1 \end{bmatrix}\vec{x}

Our matrix is designed to rotate on the x and y coordinates, which is why the third column is set as the identity, \begin{bmatrix} 0 \\ 0 \\ 1 \end{bmatrix}. Aside from this, our matrix looks much the same as the \mathbb{R}^2 matrix.

Similar to rotation, we can also stretch, contract, and dilate vectors. A stretch will modify the first component, but leave the second component unchanged. To do this, we can use the following matrix: \begin{bmatrix} t & 0 \\ 0 & 1 \end{bmatrix}. If t < 1, we typically refer to this as a shrink, and if t > 1, we refer to this as a stretch.

Contractions and dilations are similar to stretches and shrinks, but they affect both components of the target vector. Due to this, the matrix ends up looking similar to the stretch, however both components are t. This gives us \begin{bmatrix} t & 0 \\ 0 & t \end{bmatrix}. If 0 < t < 1, the transformation is called a contraction. Otherwise, it is called a dilation.

A shear is a type of linear transformation that deforms a shape, in a similar way to translating a rectangle into a parallelogram. The matrix for this deformation looks like \begin{bmatrix} 1 & s \\ 0 & 1 \end{bmatrix}.

Finally, vectors can be reflected over the x and y axis using matrix transformations. If we are mirroring on the x axis, we use \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix}. If we are mirroring on the y axis, we use \begin{bmatrix} -1 & 0 \\ 0 & 1 \end{bmatrix}

In general, geometric translations are an important application of matrix mappings. If you continue in computer programming, you will often see these types of translations used for graphics, especially in game engines. Aside from programming, Physics often uses these types of translations for vectors that appear in problems.

1 thought on “Geometric Transformations”

Leave a Reply

Your email address will not be published. Required fields are marked *