QVM: Quaternions, Vectors, Matrices

Boost QVM is a generic library for working with quaternions, vectors and matrices of static size with the emphasis on 2, 3 and 4-dimensional operations needed in graphics, video games and simulation applications.

Introduction

In graphics and simulation applications, there is a need for a library that makes it easy to perform 2D and 3D transformations efficiently. C++ makes it possible to define vector and matrix types and to overload various operators to implement the standard algebraic operations. Because this is a relatively straightforward process, there are many such libraries in existence, each with its own types and operator overrloads. Such libraries are typically part of a higher level system, such as a graphics engine or a 3D modeling API. As a result, it is typical for programmers to have to integrate and to translate between several different quaternion, vector and matrix types that come with the various APIs they use.

On the other hand, performance considerations often lead to matrix and vector types becoming coupled with a particular platform, or to (over time) acquire various #ifdefs needed to enable optimizations through platform-specific compiler features that control the physical format or layout of their elements. However, such optimizations may interfere with ease of use and portability; for example on some platforms requiring 16-byte alignment for matrix types makes them incompatible with standard containers.

Boost QVM solves both of these issues by decoupling the standard algebraic operations from the types they operate on -- without compromising type safety.

Key design features of Boost QVM:

  • Emphasis on 2, 3 and 4-dimensional operations (including quaternions and zero-overhead Swizzling) as needed in graphics and simulation applications.
  • Zero-overhead view proxies that can be used to access an object with quaternion, vector or matrix semantics through a read-only or mutable reference of a different type. For example, col<C>(m) binds the C-th column of a matrix m as a mutable vector type without the overhead of a temporary.
  • Integration of many user-defined or 3rd-party quaternion, vector or matrix types into a coherent type-safe system. This enables the user to build algebraic expressions using objects of diverse types that would otherwise be incompatible.
  • When users need to implement platform-specific or even project-specific optimizations in a given subsystem, Boost QVM makes it simple to define custom new types that automatically aquire the full set of algebraic operations so they can interface seamlessly with the rest of the program. At the same time, the user can define a limited number of overloads for the new types as needed to implement specific optimizations.

Contents

  1. Tutorial
  2. Reference
  3. Synopsis
  4. Code generator
  5. Known quirks and issues
  6. Questions and answers
  7. Indexes

Download

QVM is part of Boost. Please see git submodule at https://github.com/boostorg/qvm.

Support

For support, please use the Boost Developers Mailing List.