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

Matrix class and functions. More...

Detailed Description

Matrix class and functions.

MathFu provides a generic Matrix implementation which is specialized for 4x4 matrices to take advantage of optimization opportunities using SIMD instructions.

Classes

class  mathfu::Matrix< T, rows, columns >
 Matrix stores a set of "rows" by "columns" elements of type T and provides functions that operate on the set of elements. More...
 
class  mathfu::Constants< float >
 Functions that return constants for float values. More...
 
class  mathfu::Constants< double >
 Functions that return constants for double values. More...
 

Typedefs

typedef Matrix< float, 4, 3 > mathfu::AffineTransform
 A typedef representing a 4x3 float affine transformation. Since the last row ('w' row) of an affine transformation is fixed, this data type only includes the variable information for the transform.
 

Functions

template<class T , int rows, int columns>
Matrix< T, rows, columns > operator* (const T &s, const Matrix< T, columns, rows > &m)
 Multiply each element of a Matrix by a scalar. More...
 
template<class T , int rows, int columns>
Vector< T, rows > operator* (const Matrix< T, rows, columns > &m, const Vector< T, columns > &v)
 Multiply a Matrix by a Vector. More...
 
template<class T >
Vector< T, 3 > operator* (const Matrix< T, 4, 4 > &m, const Vector< T, 3 > &v)
 Multiply a 4x4 Matrix by a 3-dimensional Vector. More...
 

Function Documentation

template<class T , int rows, int columns>
Matrix< T, rows, columns > operator* ( const T &  s,
const Matrix< T, columns, rows > &  m 
)
related

Multiply each element of a Matrix by a scalar.

Parameters
sScalar to multiply by.
mMatrix to multiply.
Returns
Matrix containing the result.
Template Parameters
TType of each element in the Matrix and the scalar type.
rowsNumber of rows in the matrix.
columnsNumber of columns in the matrix.
template<class T , int rows, int columns>
Vector< T, rows > operator* ( const Matrix< T, rows, columns > &  m,
const Vector< T, columns > &  v 
)
related

Multiply a Matrix by a Vector.

Note
Template specialized versions are implemented for 2x2, 3x3, and 4x4 matrices to increase performance. The 3x3 float is also specialized to supported padded the 3-dimensional Vector in SIMD build configurations.
Parameters
mMatrix to multiply.
vVector to multiply.
Returns
Vector containing the result.
template<class T >
Vector< T, 3 > operator* ( const Matrix< T, 4, 4 > &  m,
const Vector< T, 3 > &  v 
)
related

Multiply a 4x4 Matrix by a 3-dimensional Vector.

This is provided as a convenience and assumes the vector has a fourth component equal to 1.

Parameters
m4x4 Matrix.
v3-dimensional Vector.
Returns
3-dimensional Vector result.