当前位置:网站首页>Left multiply right multiply matrix problem

Left multiply right multiply matrix problem

2022-06-23 07:35:00 Niu Shenzi

When transforming a vector , The left and right multiplication matrices are actually the same ( Maybe someone will raise an objection ), Our goal is to transform vectors , Vectors are interpreted the same by column or row .

a It's a vector ,M It's a matrix , The end result is a vector , The result of a vector and its transpose is the same , Only when multiplied by a matrix :

According to the theorem of matrix transpose
(aM) The transpose = M The transpose * a The transpose

A key conclusion :
aM = M The transpose * a The transpose
The row vector times the matrix is equal to the transpose of the matrix times the column vector ( Transpose of row vectors )

This explains the different rotation matrices in some books

as follows :
1.2D Rotation matrix
If it's a vector left multiply matrix , The rotation matrix is :M
cos(angle) sin(angle)
-sin(angle) cos(angle)

vector a=(x,y)

Vector left multiply matrix : a* M

And some books 2D The rotation matrix is like this :M2
cos(angle) -sin(angle)
sin(angle) cos(angle)

Vector right multiply matrix :M2 * a

This is the conclusion above ,a*M=M2 * a

The row vector times the matrix is equal to the transpose of the matrix times the column vector ( Transpose of row vectors )

So some books use column vector right multiplication , Some are left multiplication of row vectors , To make a difference , The result is the same .

The row vector times the matrix , Each row of the matrix is the transformed basis vector .
Matrix Times column vector , Each column of a matrix is a transformed basis vector .

notes : And the basis vector here is not normalized , It can be scaled differently .

Unity In the essentials of introduction, the object is transformed from object space to world space , Get the position and direction of the coordinate axis of the object in world space , Directly put the base vector of the coordinate axis into the first three columns of the matrix , When the position of the coordinate axis is placed in the fourth column, the matrix from the object to the world is constructed .

Similarly, it can be extended to 3x3、4x4 matrix

such as 4x4 Translation matrix , Some books put the offset in the fourth column , Some are put on the fourth line , The principle of same .

原网站

版权声明
本文为[Niu Shenzi]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/174/202206230640286546.html