相关专业大学时都学过线代, 然而等到真正需要用的时候,已经过去好久了导致很多东西都忘了,所以需要专门开一贴记录一下,这里就当是个汇总吧
1):向量点乘与其向量夹角之间的关系:
2):向量b在向量a上的投影(其中为向量ab之间的夹角):
3):向量a和b的叉乘(积):
,其中i, j, k为基向量
- a和b的向量积同时垂直于这两个向量
- 维向量不存在向量积
- 计算二维向量的向量积时, 第三维补0,同上公式
4):转置矩阵、 标准伴随矩阵、代数余子式、逆矩阵与正交矩阵
设矩阵,这个M必须为方阵,不然就是换维操作,没有下面的东西
- 转置矩阵:行列翻转,,
- 余子式:矩阵对应行列式去掉某一行某一列后的新行列式:
- 代数余子式矩阵:显然一个的行列式共有个余子式,这个余子式的值(代数余子式)构成的矩阵即代数余子式矩阵,代数余子式与余子式之间的关系:
- 标准伴随矩阵:接上,即代数余子式构成的方阵进行转置后得到:
- 逆矩阵: 矩阵本质上就是对空间的线性变换,而逆矩阵的意义就是将进行了对应线性变换后的空间再“变回去”,即满足,其中为单位矩阵,标准求法:,其中为矩阵对应行列式的值(当然了,这个行列式的值不可为0,值为0就意味着不存在可逆矩阵)
- 正交矩阵:满足 的矩阵,矩阵中任意两个向量两两正交,且长度为1
5):4x4 齐次矩阵
- 齐次坐标:将一个原本是 n 维的向量用一个 n+1 维向量来表示,对于 3d 图形,只有 4x4 的齐次矩阵才能满足其各种操作(平移、旋转、透视、小孔成像等), 对于这个 4x4 矩阵的第四维 ,我们一般称其为齐次坐标
6):向量缩放与位移
- 缩放:设有向量 ,缩放变量为 ,则对应的缩放矩阵为
- 位移:非线性变换,设有向量 ,位移向量为 ,则对应的位移矩阵为,如果向量 仅表示方向,那么位移向量应该对其无效,此时需要将向量的 分量设为 0
7):欧拉角旋转
注:以下的所有旋转轴一定为单位向量,其中围绕着x, y, z轴的旋转即第一种情况的特例
- 旋转:设有向量 ,围绕着轴 旋转度,则对应的缩放矩阵为
- 围绕着轴x旋转:
- 围绕着轴y旋转:
- 围绕着轴z旋转:
欧拉角旋转远比上述计算要复杂,更多关于欧拉角旋转的知识可以参考:OpenGL基础16:视角_Jaihk662的博客-CSDN博客_opengl视角