   boost quaternions
  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   
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?ThanksAlthough 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.   ;  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.   ;  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. 