Share

mjbWorld

The forum address has changed, you have been automatically redirected. Please update any bookmarks to use the new URL.

Subscribe

Matrix to Quaternion error.

You are viewing a single message from this topic. View all messages.

  1. 2009-06-17 18:09:50 UTC
    Hi Martin,

    I was looking at the matrixToQuaternion page, and I think the "Better code" and "C++ code" sections may have a problem with numerical stability as Tr + 1 may approach 0 in some cases. The test for greater-than-epsilon helps, but a better solution may be found in the implementation from the Wild Magic package by Dave Eberly:
    http://www.geometrictools.com/LibFoundation/Mathematics/Wm4Quaternion.inl
    (See "FromRotationMatrix" function)

    There, they compare Tr > 0 (instead of Tr+1 > 0) for the initial conditional, thus avoiding getting close to 0 in the 0.5 / sqrt(Tr + 1) which follows it.

    Do you have any thoughts, does this make sense to you? The implications of falling into the 'else' clause are the main concern here, but that seems safe, and appears to work in practice.

    Thanks!
< Previous | 1 | 2 | Next >

Add a Reply

This forum does not allow anonymous participation.

Log in to add a reply. Not registered? Create an account to participate and receive email updates when replies are posted to this topic.