3D Maths - Transformations



In this chapter, we will focus more on 3D rotations or transformations. 3D rotation is not considered as same as 2D rotation. In 3D rotation or transformations, it is important that we specify the angle of rotation along with the axis of rotation. The user can perform 3D rotation about X, Y, and Z axes. The matrix representation with all axes is mentioned below −

$$\begin{bmatrix}x' \\y'\\z' \end{bmatrix}=\begin{bmatrix}1 & 0 & 0\\ 0 & cos(\theta) & -sin(\theta)\\ 0 &sin(\theta) &cos(\theta) \end{bmatrix}\begin{bmatrix}x \\y\\z \end{bmatrix}Rotation\:around\:x\:axis$$ $$\begin{bmatrix}x' \\y'\\z' \end{bmatrix}=\begin{bmatrix}cos(\theta)& 0 &-sin(\theta) \\ 0 & 1& 0 \\ sin (\theta)& 0 &cos(\theta) \end{bmatrix}\begin{bmatrix}x \\y\\z \end{bmatrix}Rotation\:around\:y\:axis$$ $$\begin{bmatrix}x' \\y'\\z' \end{bmatrix}=\begin{bmatrix}cos(\theta) &-sin(\theta)& 0 \\ sin(\theta) & cos(\theta)& 0 \\ 0& 0 &1 \end{bmatrix}\begin{bmatrix}x \\y\\z \end{bmatrix}Rotation\:around\:z\:axis$$

There are various types of transformations which take place in 3D Algebra as follows −

  • Linear Transformation
  • Affine Transformation

Now it is important to focus on each one of them to understand the mathematical theory underneath.

Linear Transformation

A linear transformation usually consists of input and output values which is completely different from 3D vectors.

Consider the following example which describes linear transformation for representation of matrix. The mathematical function which we will interpret is as follows −

T (v) = T(x , y , z) = (x′, y′, z′).

This function takes input as 3D vector and gives an output of a 3D vector. With this equation, it is clearly visible that τ includes a constant value linear transformation if and only if following conditions are true −

T (u + v) = T (u) + T (v)

T (k u) = kT (u)

where u = (ux ,uy ,uz) and v = (vx ,vy ,vz) are any 3D vectors, and k is a scalar.

Affine Transformation

If the value of constant b is considered 0, the affine transformation reduces to a linear transformation. This means the user can represent any linear transformation by a 4 × 4 affine matrix. For example, the scaling and rotation matrices written using 4 × 4 matrices is described in demonstration below −

$$S= \begin{bmatrix}s_x&0 &0 &0 \\ 0 &s_y &0 &0 \\0 &0 &s_z &0 \\0 &0 &0 &1 \\\end{bmatrix}$$ $$R_n=\begin{bmatrix} c+(1-c)x^2&(1-c)xy+sz &(1-c)xz-sy &0 \\(1-c)xy-sz&c+(1-c)y^2 &(1-c)yz+sx &0 \\(1-c)xz+sy&(1-c)yz-sx &c+(1-c)z^2 &0 \\0&0 &0 &1 \\\end{bmatrix}$$

In this way, we can express all of our transformations consistently using 4 × 4 matrices and points and vectors using 1 × 4 homogeneous row vectors.

Advertisements