# 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
   1. Quaternions, Vectors, Matrices
   2. C Arrays
   3. Views
   4. Swizzling
   5. SFINAE/enable_if
   6. Interoperability
2. Reference
   1. Type traits
   2. Quaternion, vector and matrix types
   3. Accessing quaternion elements
   4. Accessing vector elements
   5. Accessing vector elements by swizzling
   6. Accessing matrix elements
   7. Quaternion operations
   8. Vector operations
   9. Matrix operations
   10. Quaternion-vector operations
   11. Vector-matrix operations
   12. Matrix-to-matrix view proxies
   13. Vector-to-matrix view proxies
   14. Matrix-to-vector view proxies
   15. Generic programming utilities
   16. Exception types
   17. Macros and configuration
   18. Namespace boost::qvm::sfinae
3. Synopsis
4. Code generator
5. Known quirks and issues
6. Questions and answers
7. Indexes
   1. Index of Headers
   2. Index of Functions
   3. Index of View Proxies
   4. Index of Types

### 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.