Gamedev Framework (gf)  0.3.0
A C++11 framework for 2D games
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
gf::Matrix< T, 4, 4 > Struct Template Reference

A 4x4 matrix. More...

#include <gf/Matrix.h>

Public Types

using value_type = T
 The value type of the elements of the matrix. More...
 

Public Member Functions

constexpr Matrix (T xx, T xy, T xz, T xw, T yx, T yy, T yz, T yw, T zx, T zy, T zz, T zw, T wx, T wy, T wz, T ww)
 Constructor that takes all the elements. More...
 

Public Attributes

union gf::Matrix< T, 4, 4 >:: { ... }  
 
T grid [4][4]
 Grid representation. More...
 
T data [16]
 Array representation. More...
 
T xx
 
T xy
 
T xz
 
T xw
 
T yx
 
T yy
 
T yz
 
T yw
 
T zx
 
T zy
 
T zz
 
T zw
 
T wx
 
T wy
 
T wz
 
T ww
 

Static Public Attributes

static constexpr std::size_t Rows = 4
 The number of rows in the matrix. More...
 
static constexpr std::size_t Cols = 4
 The number of columns in the matrix. More...
 

Detailed Description

template<typename T>
struct gf::Matrix< T, 4, 4 >

A 4x4 matrix.

This specialization of gf::Matrix handles affine transformation of 3D vectors (using homogeneous coordinates).

Each element of the matrix can be accessed through a name with a double letter indicating the column and row of the element (e.g. xy indicates the first row and second column).

A common typedef is defined:

Member Typedef Documentation

template<typename T >
using gf::Matrix< T, 4, 4 >::value_type = T

The value type of the elements of the matrix.

Constructor & Destructor Documentation

template<typename T >
constexpr gf::Matrix< T, 4, 4 >::Matrix ( T  xx,
T  xy,
T  xz,
T  xw,
T  yx,
T  yy,
T  yz,
T  yw,
T  zx,
T  zy,
T  zz,
T  zw,
T  wx,
T  wy,
T  wz,
T  ww 
)
inline

Constructor that takes all the elements.

Parameters
xxThe element in the first row and first column
xyThe element in the first row and second column
xzThe element in the first row and third column
xwThe element in the first row and fourth column
yxThe element in the second row and first column
yyThe element in the second row and second column
yzThe element in the second row and third column
ywThe element in the second row and fourth column
zxThe element in the third row and first column
zyThe element in the third row and second column
zzThe element in the third row and third column
zwThe element in the third row and fourth column
wxThe element in the fourth row and first column
wyThe element in the fourth row and second column
wzThe element in the fourth row and third column
wwThe element in the fourth row and fourth column

Member Data Documentation

union { ... }

An anonymous union to handle the various representations

template<typename T >
constexpr std::size_t gf::Matrix< T, 4, 4 >::Cols = 4
static

The number of columns in the matrix.

template<typename T >
T gf::Matrix< T, 4, 4 >::data[16]

Array representation.

template<typename T >
T gf::Matrix< T, 4, 4 >::grid[4][4]

Grid representation.

template<typename T >
constexpr std::size_t gf::Matrix< T, 4, 4 >::Rows = 4
static

The number of rows in the matrix.

template<typename T >
T gf::Matrix< T, 4, 4 >::ww
template<typename T >
T gf::Matrix< T, 4, 4 >::wx
template<typename T >
T gf::Matrix< T, 4, 4 >::wy
template<typename T >
T gf::Matrix< T, 4, 4 >::wz
template<typename T >
T gf::Matrix< T, 4, 4 >::xw
template<typename T >
T gf::Matrix< T, 4, 4 >::xx
template<typename T >
T gf::Matrix< T, 4, 4 >::xy
template<typename T >
T gf::Matrix< T, 4, 4 >::xz
template<typename T >
T gf::Matrix< T, 4, 4 >::yw
template<typename T >
T gf::Matrix< T, 4, 4 >::yx
template<typename T >
T gf::Matrix< T, 4, 4 >::yy
template<typename T >
T gf::Matrix< T, 4, 4 >::yz
template<typename T >
T gf::Matrix< T, 4, 4 >::zw
template<typename T >
T gf::Matrix< T, 4, 4 >::zx
template<typename T >
T gf::Matrix< T, 4, 4 >::zy
template<typename T >
T gf::Matrix< T, 4, 4 >::zz