Normalizing a quasi-rotation matrix

5.4k Views Asked by At

I have a rotation matrix $R$ generated after a lot of multiplications, inverting and so on. However, the outcome is not completely normalized, e.g., $R R^T \neq I$, but close. How can I fully normalize it?

1

There are 1 best solutions below

0
On BEST ANSWER

There are lots of ways to orthogonalize the matrix.

One of the comments already mentioned the SVD method. $$\eqalign{ R &= USV^T,\quad R_s &= UV^T \cr }$$ Consider the skew and Cayley transformations of a matrix $A$: $$\eqalign{ &{\rm skew}(A) = \tfrac{1}{2}(A-A^\dagger) \\ &{\rm cay}(A) = (I+A)^{-1}(I-A) \\ &A = {\rm cay}({\rm cay}(A)) }$$ Then another way to repair your bad $R$ matrix is the following sequence of operations $$\eqalign{ R_c &= {\rm cay}({\rm skew}({\rm cay}(R))) \cr }$$ You can do something similar with exponentials and logarithms. $$\eqalign{ R_e &= \exp({\rm skew}(\log(R))) \cr }$$ Polar decomposition offers yet another way $$\eqalign{ R_p &= R(R^TR)^{-1/2} \cr }$$


But the best method is to iterate $$\eqalign{ R := \tfrac{3}{2}R - \tfrac{1}{2}RR^TR }$$ until $\det(R)$ is sufficiently close to ${\large\tt 1}$, or $\big(R-RR^TR\big)$ is close to zero.

Notice that this iteration does not require any expensive decompositions, or matrix inverses, or transcendental functions. It is also quadratically convergent, so even if you've lost half of the digits in $R$ due to rounding errors, you will gain them all back with a single iteration.

Update

Yet another method, with a fairly low operation count $$R_a = {\rm cay}\bigg(\frac{R^T-R}{1+{\rm Tr}(R)}\bigg)$$