如何将 3x3 旋转矩阵转换为 4x4 矩阵? [英] How to convert a 3x3 rotation matrix into 4x4 matrix?
问题描述
我目前使用 3x3 旋转矩阵来处理 3D 点.
I'm currently using a 3x3 rotation matrix to work with 3D points.
这个矩阵与 4x4 矩阵有何不同?
How does this matrix differ from a 4x4 Matrix?
如何将 3x3 矩阵转换为 4x4 矩阵?
And how do I convert a 3x3 matrix into a 4x4?
推荐答案
一个 4x4 矩阵可用于在单个矩阵中进行旋转和平移.
A 4x4 matrix can be used to do both rotation and translation in a single matrix.
矩阵右侧的 tx
、ty
值将添加到您要变换的顶点的 x、y、z.
The tx
, ty
values down the right side of your matrix would be added to the x, y, z of the vertex you are transforming.
因此要将 3x3 矩阵转换为 4x4,您只需复制 3x3 左上块的值,如下所示:
So to convert a 3x3 matrix to a 4x4, you simply copy in the values for the 3x3 upper left block, like so:
[ a11 a12 a13 ]
[ a21 a22 a23 ]
[ a31 a32 a33 ]
那个 3x3 变成了这个 4x4
That 3x3 becomes this 4x4
[ a11 a12 a13 0 ]
[ a21 a22 a23 0 ]
[ a31 a32 a33 0 ]
[ 0 0 0 1 ]
请注意,在 4x4 中,左上角的块被直接复制了,并且为其他新的额外条目输入了 0(表明我不想添加任何翻译).
Notice in the 4x4 the upper left block got straight copied, and 0's were entered for the other new, extra entries (indicating I don't want any translation to be added).
这篇关于如何将 3x3 旋转矩阵转换为 4x4 矩阵?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!