3

I read a code about 3x3 matrix related calculation, and there is no comment for all the code.

There is a crossMatrix function, which, I don't understand. It is defined as:

  void Matrix3x3::v31xv31_crossMatrix(Vector inV, double diag, Matrix3x3 *poutM) {
      poutM->m33_setZero(poutM);
      poutM->m[0] = diag;
      poutM->m[4] = diag;
      poutM->m[8] = diag;
      poutM->m[3] = inV.m[2];
      poutM->m[1] = -inV.m[2];
      poutM->m[6] = -inV.m[1];
      poutM->m[2] = inV.m[1];
      poutM->m[7] = inV.m[0];
      poutM->m[5] = -inV.m[0];
  }

By writing elements as matrix in math, it looks like this:

   diag    -m[2]    m[1]
   m[2]     diag   -m[0]
  -m[1]     m[0]    diag

I'm not familiar with this form. Any idea what this matrix is called? What does it do?

ChrisZZ
  • 131

2 Answers2

3

Vector cross product $a \times b$ can be represented as matrix $[a]_\times$ product with vector $b$

$$ a\times b = [a]_\times b, $$

where

$$[a]_\times = \left[\begin{matrix}0 & -a_3 & a_2\\ a_3 & 0 & -a_1 \\ -a_2 & a_1 & 0 \end{matrix}\right].$$

More information one can find here. I hope this will help with the question.

2

In addition to the skew symmetric cross product matrix, there's also a diagonal component. So it's a linear operator
$$ L = diag*I + [m]_\times $$

the effect on a vector would be to scale it by diag and add it to the cross product of that vector with m. This is a common operator when integrating angular velocity/momentum.