GAMES101 Lesson 3 Transformation - Study Notes

At the end of the second class of GAMS101, Mr. Yan introduced the matrix Matrices after explaining the basic knowledge of vectors.

1) Matrix and vector multiplication

 Think of vectors as column vectors (i.e. M\times 1matrices) with matrices on the left and vectors on the right.

Example: In a two-dimensional plane, perform y-axis symmetric operations on vectors.

Given any point (x,y), when the y-axis is used as the axis of symmetry, the symmetrical point is (-x,y).

If we have a matrix at this point \begin{pmatrix} -1 & 0\\ 0 & -1 \end{pmatrix}, multiplying this matrix by the vector (x,y), we get

\begin{pmatrix} -1 & 0\\ 0 & 1 \end{pmatrix}\begin{pmatrix} x\\ y \end{pmatrix}=\begin{pmatrix} -x\\ y \end{pmatrix}

In this way, we \begin{pmatrix} -1 & 0\\ 0 & -1 \end{pmatrix}realize the y-axis symmetric reflection operation on the vector through the matrix.

The point product and cross product of vectors can also be expressed in matrix form

 

 

In the third class, we mainly learn to realize the transformation of graphics through matrices.

In graphics, matrices are widely used to represent transformations. (In Graphics, pervasively used to represent transformations)

2) Two-dimensional transformation

Scale scaling transformation

 Reflection reflection transformation

 Shear transformation

 Rotate rotation transformation

 For the above four transformations, we use the Rotate transformation to explain.

In two-dimensional transformation, assuming an original point (x, y), after some transformation, becomes (x', y'), written as an expression

\begin{bmatrix} x'\\ y' \end{bmatrix}=\begin{bmatrix} A & B\\ C & D \end{bmatrix}\begin{bmatrix} x\\ y \end{bmatrix}

Among them, \begin{bmatrix} A &B \\ C& D \end{bmatrix}is called the transformation matrix.

When solving the transformation matrix \begin{bmatrix} A &B \\ C& D \end{bmatrix}, we can select the values ​​of special points before and after transformation, and bring them into the expression for evaluation.

Rotation transformation. When rotating \thetathe angle, we select two special points (1,0) and (0,1) respectively. After the two points are rotated, the transformed positions become \left ( cos\theta ,sin\theta \right )and respectively \left ( -sin\theta ,cos\theta \right ). We bring back the expression , can get

\begin{bmatrix} cos\theta \\ sin\theta \end{bmatrix}=\begin{bmatrix} A & B\\ C & D \end{bmatrix}\begin{bmatrix} 1\\ 0 \end{bmatrix}

\begin{bmatrix} -sin\theta \\ cos\theta \end{bmatrix}=\begin{bmatrix} A & B\\ C & D \end{bmatrix}\begin{bmatrix} 0\\ 1 \end{bmatrix}

We expand the above two expressions in turn to get the following:

cos\theta =A\times 1+B\times 0,getcos\theta=A

sin\theta =C\times 1+D\times 0,getsin\theta =C

and

-sin\theta =A\times 0+B\times 1,get-sin\theta =B

cos\theta =C\times 0+D\times 1,getcos\theta =D

Putting the obtained value back into the expression, we get

\begin {bmatrix} x'\\ y' \end{bmatrix}=\begin{bmatrix} cos\theta & -sin\theta \\sin\theta & cos\theta \end{bmatrix}\begin{bmatrix} x \\ and \end{bmatrix}

In this way, we get the transformation matrix for rotation.

We can uniformly write the four transformations of scaling, reflection, shearing, and rotation as the following formula:

 We call them Linear Transforms.

However, if we discuss the Translation translation transformation again, we will find that

 The expression is

\begin{bmatrix} x'\\ y' \end{bmatrix}=\begin{bmatrix} 1 &0 \\ 0 & 1 \end{bmatrix}\begin{bmatrix} x\\ y \end{bmatrix}+\begin{bmatrix} t_{x}\\ t_{y} \end{bmatrix}

Among them, \begin{bmatrix} t_{x}\\ t_{y} \end{bmatrix}represents the translation amount of x and y.

In order to unify linear transformations such as scaling, reflection, shearing, and rotation, and nonlinear transformations such as translation transformations into a matrix form, we artificially introduce Homogeneous Coordinates.

 In 2D coordinates, we add a third coordinate. We stipulate:

If the third coordinate is 1, it means a two-dimensional point;

If the third one is 0, it means a two-dimensional vector;

We use homogeneous coordinates to accomplish the appeal of various transformations in a unified matrix form.

 After completing the uniform matrix form, we can study the properties of the transformation by studying the matrix.

inverse transform

 combination of transformations

 transformation decomposition

 3) Three-dimensional transformation

On the basis of two dimensions, we extend to three dimensions.

 In three-dimensional homogeneous coordinates, we unify the three-dimensional matrix form.

Guess you like

Origin blog.csdn.net/m0_74178120/article/details/128986963