Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.

QVM: Quaternions, Vectors, Matrices

Questions and Answers

Q: What is the motivation behind Boost QVM? Why not just use uBLAS/Eigen/CML/GLM/etc?

A: The primary domain of Boost QVM is realtime graphics and simulation applications, so it is not a complete linear algebra library. While (naturally) there is some overlap with such libraries, QVM puts the emphasis on 2, 3 and 4 dimensional zero-overhead operations (hence domain-specific features like Swizzling).

Q: How does the qvm::vec (or qvm::mat, or qvm::quat) template compare to vector types from other libraries?

A: The qvm::vec template is not in any way central to the vector operations defined by QVM. The operations are designed to work with any user-defined vector type or with 3rd-party vector types (e.g. D3DVECTOR), while the qvm::vec template is simply a default return type for expressions that use arguments of different types that would be incompatible outside of QVM. For example, if the deduce_mat2 hasn't been specialized, calling cross with a user-defined type vec3 and a user-defined type float3 returns a qvm::vec.

Q: Why doesn't QVM use [] or () to access vector and matrix elements?

A: Because it's designed to work with user-defined types, and the C++ standard requires these operators to be members. Of course if a user-defined type defines operator[] or operator() they are available for use with other QVM functions, but QVM defines its own mechanism for accessing vector elements, as well as Swizzling support.

See also: Boost QVM