I have a set of points that represent a rigid cylinder for which I calculate its rotation in space (x,y,z) using the formula
$ \mathbf{J} = \mathbf{R^T} \mathbf{J_0} \mathbf{R} $
with R being the rotation matrix and $J_0$ the inertia tensor for local coordinates.
To get the rotation tensor I calculate the cross product of the normalized vector pointing in the cylinder's current orientation $\mathbf{p}$ and the unit vector $\mathbf{p_0} = (0,1,0)^T$ (matching $J_0$),
$\mathbf{n} = \mathbf{p} \times \mathbf{p_0}$
which leaves me with the orientation of the rotation axis $\mathbf{n}$ and the angle of rotation $\varphi$:
$\mathbf{n} = (-p_z, 0, p_x)^T$ and $\sin(\varphi) = \sqrt{{p_x}^2 + {p_z}^2}$
Using those information I can easily calculate my rotation matrix (see e.g. wiki -> rotation matrix).
Now I have the following problem: The cylinder points are stored in an unsorted array. When calculating the orientation vector I simply subtract the position of two random points in the cylinder and normalize the vector. Hence I do not know which direction my vector is pointing: it can be $\mathbf{p}$ or $-\mathbf{p}$. Pyhsically there should be no difference in the calculation of my inertia tensor due to the symmetry of a cylinder. But how do I prove it mathematically?
I tried writing down the rotation matrix and looked for symmetries/squares or other ways to get rid of the minuses, but could not find a way. I believe the solution lies in the first equation mentioned and the multiplication with the transposed rotation matrix. Someone already tried to explain it here (last comment), but it does not apply, if you only calculate the inertia tensor...
Maybe someone could explain why the multiplication with the transpose is necessary, what kind of rotation it represents and why (or if) it leads to the sign independency of the orientation tensor.
Thanks a lot in advance!
With the insight from @Tobias I managed to clear things up a little:
considering the values of $\mathbf{n}$ the rotation matrix can be simplified to $ R = \left(\begin{matrix} p_z^2&-p_z \sqrt{p_x^2 + p_z^2}&p_xp_z\\ p_z\sqrt{p_x^2+p_z^2}&0&-p_x\sqrt{p_x^2 + p_z^2}\\ p_zp_x&p_x\sqrt{p_x^2 + p_z^2}&p_z^2 \end{matrix}\right) $
Then the matrix can product $\mathbf{J} = \mathbf{R^T} \mathbf{J_0} \mathbf{R}$ can be solved and it becomes apparent, that every component of the matrix is dependent on squares of $p_i$, thus making it independent of the orientation vector's sign.
The multiplication of the inertia tensor with the rotation matrix's transpose is necessary when rotating a matrix (like $\mathbf{J_0}$). When rotating a vector $\mathbf{a_0}$ it is sufficient to calculate
$ \mathbf{a} = \mathbf{R} \mathbf{a_0} $