MathFu
An open source project by FPL.
 All Classes Namespaces Files Functions Variables Typedefs Friends Groups Pages
Introduction

About MathFu

MathFu is a C++ math library developed primarily for games focused on simplicity and efficiency.

It provides a suite of vector, matrix and quaternion classes to perform basic geometry suitable for game developers. This functionality can be used to construct geometry for graphics libraries like OpenGL or perform calculations for animation or physics systems.

Prerequisites

MathFu is written in C++, you are expected to be experienced in C++ programming. MathFu should not be your first C++ programming project! You should be comfortable with compiling, linking, and debugging.

About This Guide

This guide provides an overview of the MathFu API, it does not cover every aspect of functionality provided by the library. The entire API is documented by the API reference. In addition, the unit tests (under mathfu/unit_tests) provide example usage of each class and function in the library.

Concepts

The core functionality of MathFu is provided by the following classes:

Each class is described in the following sections of the guide:

  • Vector
    • A geometric concept with a magnitude and direction, defined in any dimensional space.
  • Matrix
    • A set of data organized in rows and columns. MathFu matricies may have any number of rows and columns.
  • Quaternion
    • A specific type of four dimensional vector and defines a rotation in three dimensional space.

In addition, MathFu provides a suite of general math functions and method that make it easier to handle the special requirements of SIMD data types described in the Utilities section.

Optimization

MathFu is optimized using SIMD instructions (including NEON for ARM and SSE for x86 architectures). SIMD optimization is enabled by default based upon the target platform and compiler options used to build a project. In addition, MathFu provides compile time options to modify code generation, see Build Configurations for more details.

Supporting Additional Architectures

MathFu's SIMD implementation uses vectorial as an abstraction layer for common SIMD instructions and data types. To support additional architectures, contributors can add support for new SIMD instructions and data types to the vectorial project and then modify the code in mathfu/utilities.h to define the macro MATHFU_COMPILE_WITH_SIMD for the new architecture.