Quaternion questions: possible bugs in Slerp and ToAngleAxis

Greenjacket

09-10-2006 09:40:25

I've just been looking through the Ogre and OgreDotNet Quaternion slerp code, and looking at the case where the sign on the second quaternion is negated. My understanding is that either you negate the sign of the second quaternion, or alternatively negate the sign of its coefficient: in this implementation, that would be something like:

coeff1 = - coeff1;

rather than the current

coeff0 = - coeff0;

Would my understanding be right (or am I talking out my a**e!!) :wink: If I'm right, this also affects the Ogre implementation also. I have also posted on the Ogre forums about this.

I've also noted a possible problem with the OgreDotNet implementation of the quaternion method ToAngleAxis (where Sqrt is used instead of the correct InvSqrt): I think the line

float invLength = -(float)Math.Sqrt(sqrLength);

should be

float invLength = -1.0f / (float)Math.Sqrt(sqrLength);

or

float invLength = -(float)Math.InvSqrt(sqrLength);

Any comments?
Thanks
Greenjacket

Greenjacket

09-10-2006 16:14:27

Quaternion interpolation:
Genva (on the Ogre forum) and Dave Eberly put me right:

Aha! solved the quarternion interpolation.
The oversight on my behalf (I now understand what you're saying now) is that the effect of the (multiple) sign change(s at various stages of the algorithm) is taken care of by some smart coding.
:oops:
Thanks for your time!

I'm still not sure about the other issue in the OgreDotNet implementation though ... :roll:

Greenjacket

17-10-2006 09:21:00

The slerp bug is confirmed to be a bug - see http://www.ogre3d.org/phpBB2/viewtopic.php?p=181188#181188