Quaternion angle calculation loss of precision #3661
Replies: 2 comments
-
Thanks for the report, if there is time (and motivation) we may improve this eventually (not urgent, unless you have a reproduction example that shows issues). |
Beta Was this translation helpful? Give feedback.
-
I'd like to concur. I've dealt with this problem and loss of precision is tremendous, especially if you're using 32-bit precision floats. Example if you're trying to convert angle to cos, and back to angle from cos, you lose a lot. See here how I'm handling this in my game engine: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
In btQuaternion.h the function "btScalar getAngle() const" calculates the angle from the inverse cosine of w.
This gives numerical issues when the angle is almost zero (~1e-8 in case of double). In that case the w term becomes almost 1 in which case a lot of significant digits are lost ( w = 0.9999999999999998) and the calculation of the angle becomes less precise than possible.
This can be solved by calculating the angle from the atan2 instead:
This approach can be found in the Eigen and scipy (python) packages.
Beta Was this translation helpful? Give feedback.
All reactions