Jump to content
  • Advertisement
Sign in to follow this  
machinimist

matrix to euler (3d math primer book error?)

This topic is 4148 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi, i use the book "3d math primer for graphics and game development". on page 184 there is an example for a function which converts a rotation matrix to eulers.
float sp = -m23;

...

if(sp > 0.9999) // gimbal lock check
{
  // we are looking straight up or down
  ...
}
else
{
  ...
}
is this gimbal lock check correct? doesn't this only check for looking up? [Edited by - machinimist on May 16, 2007 7:54:19 AM]

Share this post


Link to post
Share on other sites
Advertisement
EDIT: I answered this question earlier but now I realise I was being stupid!

I don't have this book, but:

If 'sp' is a sin(x) term as seems likely, then you may be right about the 'if' statement not working as intended.

If 'sp' is a cos(x) term (e.g. 1 - cos(x)) then the 'if' statement is probably working as intended. But it would be silly to refer to cosine term as 'sp'...

I wouldn't like to say whether or not the function is correct without looking at it, so can you post the function or algorithm used, if it's fairly small?


[Edited by - tweduk on May 16, 2007 1:17:02 PM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!