quaternion libraries in C/C++ [closed]

拥有回忆 提交于 2019-12-18 11:43:15

问题


Any good libraries for quaternion calculations in C/C++ ?

Side note: any good tutorials/examples? I've google it and been to the first few pages but maybe you have have some demos/labs from compsci or math courses you could/would share?

Thanks


回答1:


I'm a fan of the Irrlicht quaternion class. It is zlib licensed and is fairly easy to extract from Irrlicht:

  • Irrlicht Quaternion Documentation
  • quaternion.h



回答2:


You could try with Boost - usually good place to start with. They have a dedicated sublibrary for that.

As for the examples look at the documentation and the unit tests that come along with Boost.




回答3:


There's Eigen, a templated library of math and geometry stuff used in Blender and by KDE programs, which has a slick Quaternion class defined in a single .h file.

Info at http://eigen.tuxfamily.org/index.php?title=Main_Page and http://www.ohloh.net/p/5393




回答4:


If you decide to roll your own, or actually want to understand the math behind the code (useful for debugging), I highly recommend Martin Baker's website. It looks primitive, but the explanations are thorough and easy to follow, and he also provides code in places.




回答5:


DirectX has its own quaternion functions, as do several other 3D libraries.

In my opinion, the best way to learn how quaternions work is to plow through the math yourself. The Wikipedia page on quaternions and conversion contain all the formulas you need. I wrote my own quaternion library from that :) (It's in Haskell, so I won't bother to post it.)




回答6:


For documentation on quaternions, check out 3D graphics text books. They are simply matrices that produce the effect of 3D rotation using multiplication instead of computationally expensive trigonometry.




回答7:


This web, euclideanspace, is very important if you are working with quaternions. It has all arithmetic step by step, equivalences, simplifications, code samples in different languages. I made most of my functions on my own following this page. I prefer that than downoading a library. Functions are easy to program and you learn on the way.

As an example I suggest you to check this c++ function about a quaternion multiplication: Efficient C++ quaternion multiplication using cv::Mat




回答8:


There is graphene which is a simple C/GObject library with SIMD optimisations for various vector, matrix, quaternion, etc calculations that are common in 3D graphics.



来源:https://stackoverflow.com/questions/508370/quaternion-libraries-in-c-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!