GAMES101 learning (2) 2D-3D transformation operation and matrix

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

insert image description here

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.
insert image description here
insert image description here

(2) Flip, similarly, the focus is on understanding the relationship between transformation operations and matrices

insert image description here

(3) cut, the same reason

insert image description here

(4) Rotation, similarly, the default is to rotate counterclockwise with the origin as the center

insert image description here

(5) Summary - linear transformation, any linear transformation can be realized by matrix calculation

insert image description here

(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
insert image description here
following formulainsert image description here

(7) The 2D transformation can be described by the following form

insert image description here

(8) Inverse transformation, that is, inverting the transformation matrix

insert image description here

(9) Combination transformation, any transformation can be realized by operations such as linear transformation + translation, and its mathematical expression is as follows:

insert image description here

insert image description here
(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)


insert image description here
insert image description here
insert image description here

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.

Guess you like

Origin blog.csdn.net/qq_40514113/article/details/129919455