Yet another question from me and hope some one shoots the answer immediately.. very simple though
I have been tryin to do a rigid body simulation ... things work fine until i hit a nan ..
What I am trying to do is retrieve a angle from a quaternion for which i wrote this following function...
This is being refered in the code by this way
void get_AxisAngle_from_Quat(float &angle, Xlib::vec3d &axis)
float squareLength = get4d_X()*get4d_X() + get4d_Y()*get4d_Y() + get4d_Z()*get4d_Z();
angle = 2.0f * (float) acos(get4d_Z());
float inverseLength ;
inverseLength = 1.0f / (float) pow(squareLength, 0.5f) ;
axis.x = get4d_X() * inverseLength;
axis.y = get4d_Y() * inverseLength;
axis.z = get4d_Z() * inverseLength;
angle = 0.0f;
axis.x = 1.0f;
axis.y = 0.0f;
axis.z = 0.0f;
but This hits a nan and everytime it hits nan my object disappears from the screen.... (DevMsg is a overload for cout i use) When i try printing out the values at the point where i hit the nan this shows this
Xlib::DevMsg("Angle ", angle);
I read online but it states nan is got by dividing by 0 .. but clearly i am not using any divisions at al...
DevMsg: Quat 1.442195 0.698514 1.700220 0.403262
can someone clarify me on where i went wrong ????
Cheers and regards