Jump to content
  • Advertisement
Sign in to follow this  
daniel_i_l

boost quaternions

This topic is 3403 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

I'm writing a physics engine and want to use quaternions to store the orientations. Do you recommend that I write one myself using the gamedev articles on the subject, or use the boost implementation? The boost implementation is probably optimized more than mine would be but it seems to be missing some essential features such as a "quaternion to matrix" function. Are there any other libraries that are easy to integrate into existing code? Thanks

Share this post


Link to post
Share on other sites
Advertisement
Quote:
I'm writing a physics engine and want to use quaternions to store the orientations. Do you recommend that I write one myself using the gamedev articles on the subject, or use the boost implementation? The boost implementation is probably optimized more than mine would be but it seems to be missing some essential features such as a "quaternion to matrix" function.
Are there any other libraries that are easy to integrate into existing code?
Thanks
Although I'm sure the Boost quaternion class would work, I don't think it's specifically geared towards games and graphics. There are plenty of other free math libraries though that offer the functionality you're looking for. You can check out the CML (linked in my signature), or take a look at this list of free libraries (math and otherwise). There's also the DirectX library if you're developing on a supported platform, or the Wild Magic library at geometrictools.com.

Share this post


Link to post
Share on other sites
In addition to quaternion class, i would suggest adding a rotation and translation class which behaves like rotation and translation matrix, but stores vector and quaternion inside. I started writing article about this topic a long while ago but didn't fully finish it; should be enough to get started though. The idea is to abstract out "Rotation" , and amke implementation of it using quaternions; if you would re-normalize quaternions after multiply, that could be highly surprising and confusing to any other developer, while Rotation class is free to do such things, e.g. invert quickly by negating real part rather than doing full quaternion inverse. Then you can make abstract RotationAndTranslation which stores Rotation and vector for translation. So that you won't really need to use quaternions directly when you just want rotations.

Share this post


Link to post
Share on other sites
Just write one yourself. It's always good to know how they actually work, and it won't be that much work anyway. I also highly doubt that boosts quaternion would be any faster, as there aren't a whole lot of optimizations you can do on such a small scale, that won't be trivial for a compiler to do automatically.

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!