矩阵数乘数学形式:

游戏开发中的数学和物理算法(16):矩阵的乘法

计算机中矩阵数乘的实现:

 scale)
{
      Matrix3X3 temp;
      for(int i = 0;i<3;i++)
      {
        
for(int j=0;j<3;j++)
        {
           temp.index[i][j] 
= (a.index[i][j] * scale);
        }
      }
      
return temp;
}

 

矩阵的乘法:

游戏开发中的数学和物理算法(16):矩阵的乘法
计算机中矩阵乘法的实现:

Matrix3X1 multiplyMatrixNxM(Matrix3X3 a, Matrix3X1 b)
{
        Matrix3X1 temp;
        temp.index[0= 0.0f;
        temp.index[
1= 0.0f;
        temp.index[
2= 0.0f;
        
for(int i=0;i<3;i++)
        {
              
for(int j=0;j<3;j++)
              {
                 temp.index[i] 
+= (a.index[i][j] * b.index[j]);
              }
        }
        
return temp;
}

相关文章:

  • 2022-12-23
  • 2021-11-17
  • 2022-12-23
  • 2022-12-23
  • 2021-09-28
  • 2021-06-11
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案