Sign in to follow this  
irdalama

Quaternion rotation and -1.#ind

Recommended Posts

Hello, im rotating an object using quartionions and then converting back to angle axis. A prooblem arises when the object makes any full rotation on one axis it disapears for a frame and then comes back. So i traced scale when this disapearing occurs it has the value -1.#ind. I know this is the problem but i dont kow what this means or how to fix it. Thanks for nay help. here is my code
 float  scale = sqrt(1 - ( qm.mData[3] * qm.mData[3] ) );     //quaternion to axis to angle converion
       
      if (scale == 0 )
      scale = 1;
        
     cout <<"scale = " << scale <<endl;
     
   	   x  = (qm.mData[0] / scale);
       y  = ( qm.mData[1] / scale);
       z  =  (qm.mData[2] / scale);                         //quaternion to axis to angle converion

      float angleq; 
      
	  angleq = acos( qm.mData[3] ) * 2.0f;                 //quaternion to axis to angle converion
      angleq = gmtl::Math::rad2Deg(angleq);
      

Share this post


Link to post
Share on other sites
Well, run through it in the debugger and see where the value's coming from. My money's on you trying to find the square root of a negative number.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this