Re: [eigen] precision loss after conversion from rotation matrix to quaternion and back

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Hi,

I guess this is because your initial matrix is not perfectly unitary.
You can orthogonalize it with, e.g.:

A = A.householderQr().householderQ();

cheers,
Gael.


On Mon, May 14, 2012 at 9:23 PM, Tobias Langner
<tobias.langner@xxxxxxxxxxxx> wrote:
> Hello all,
>
> So here is my problem:
>
> I have this rotation matrix (Scalar type double):
>
>  0.124564 -0.800873  0.584451
> -0.971925 0.0176983  0.231399
>  -0.19596 -0.597765 -0.777352
>
> Then I convert it to a Quaternion (Scalar type double) using the
> constructor. The quaternion coefficients  (x,y,z,w) are:
> 0.686334 -0.645749 0.14151 -0.302026
>
> Finally I convert the Quaternion back to a rotation matrix using the
> function toRotationMatrix(), which yields a slightly different matrix:
>
>  0.125967  -0.80092  0.584312
> -0.971878 0.0178409  0.231823
> -0.195821 -0.597341 -0.776092
> 0.686334 -0.645749 0.14151 -0.302026
>
> As you can see some numbers differ on the third significant digit, which
> cannot be explained by floating point rounding errors. So where does it come
> from? If I repeat the procedure the rotation matrix will not differ again..
> It changes only on the first forth-and-back conversion.
> I'd appreciate any help.
>
> Best regards,
>
> Tobias
>
>
>
>
>
>



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/