The content of this article is Lecture3 and Lecture4 of GAMES101, and the theme is transformation.
Course link: GAMES101B course
main course (with courseware): course homepage
First imagine a scene, when we are playing the "Sokoban" game, how do the boxes inside change?
We can simply understand that the coordinates of the box in a certain coordinate system have changed, or that the box has undergone a two-dimensional transformation.
Next, we will briefly introduce and compare some basic transformation operations:
(1) Zoom
The left side is the coordinates of the transformed object, and the right side is the scaling matrix ∗*∗ Object coordinates before transformation, s here represents the zoom factor.
(2) Flip, similarly, the focus is on understanding the relationship between transformation operations and matrices
(3) cut, the same reason
(4) Rotation, similarly, the default is to rotate counterclockwise with the origin as the center
(5) Summary - linear transformation, any linear transformation can be realized by matrix calculation
(6) Translation
Here we need to introduce "homogeneous coordinates", because the translation operation cannot be described in the following "matrix form", so the "translation" operation is not a "linear transformation". Here is the solution. By introducing the third dimension vector, we can get the
following formula
(7) The 2D transformation can be described by the following form
(8) Inverse transformation, that is, inverting the transformation matrix
(9) Combination transformation, any transformation can be realized by operations such as linear transformation + translation, and its mathematical expression is as follows:
(10) 3D transformation, in the same way, learn the 2D data processing method when processing 3D points, and describe the translation of 3D points by adding a 4th dimension (row vector w)
My official account is AI Knowledge Story, station B is to go out to eat three bowls of rice, I will update related articles or video explanations from time to time, I hope it can be helpful to you.