After multiplying a lot of rotation matrices, the end result might not be a valid rotation matrix any more, due to rounding issues (de-orthogonalized)
One way to re-orthogonalize is to follow these steps:
Is there something in Eigen library that does the same thing by hiding all the details? Or is there any better recipe?
This procedure has to be handled with care due to special singularity cases, so if Eigen provides a better tool for this it would be great.
Eigenvalues and eigenvectors of rotation matrices These notes are a supplement to a previous class handout entitled, Rotation Matrices in two, three and many dimensions. In these notes, we shall focus on the eigenvalues and eigenvectors of proper and improper rotation matrices in two and three dimensions. 1.
Thus, the eigenvalues of a real orthogonal matrix must be complex numbers of unit modulus. That is, λ = eiαfor some α in the interval 0 ≤ α < 2π. Consider the following product of matrices, where A satisfies ATA = I, AT(I−A) = A − I= −(I− A)T. Taking the determinant of both sides of this equation, it follows that4
Eigen decomposition is the process of representing vectors or a matrix by its eigenvalues and eigenvectors. The eigenvalue is like a scalar, but we will go over this in more detail in the article. Orthogonalization is the process of making vectors orthogonal.
You can use a QR decomposition to systematically re-orthogonalize, where you replace the original matrix with the Q factor. In the library routines you have to check and correct, if necessary, by negating the corresponding column in Q, that the diagonal entries of R are positive (close to 1 if the original matrix was close to orthogonal).
An alternative is to use Eigen::Quaternion
to represent your rotation. This is much easier to normalize, and rotation*rotation
products are generally faster. If you have a lot of rotation*vector
products (with the same matrix), you should locally convert the quaternion to a 3x3 matrix.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With