Gamedev Framework (gf)  0.2.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, 3, 3 > Struct Template Reference

A 3x3 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

 Matrix ()=default
 Default constructor. More...
 
constexpr Matrix (T xx, T xy, T xz, T yx, T yy, T yz, T zx, T zy, T zz)
 Constructor that takes all the elements. More...
 

Public Attributes

union gf::Matrix< T, 3, 3 >:: { ... }  
 
T grid [3][3]
 Grid representation. More...
 
T data [9]
 Array representation. More...
 
T xx
 
T xy
 
T xz
 
T yx
 
T yy
 
T yz
 
T zx
 
T zy
 
T zz
 

Static Public Attributes

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

Detailed Description

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

A 3x3 matrix.

This specialization of gf::Matrix handles affine transformation of 2D 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:

See also
transform, translate, translation, rotate, rotation, scale, scaling

Member Typedef Documentation

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

The value type of the elements of the matrix.

Constructor & Destructor Documentation

template<typename T >
gf::Matrix< T, 3, 3 >::Matrix ( )
default

Default constructor.

template<typename T >
constexpr gf::Matrix< T, 3, 3 >::Matrix ( T  xx,
T  xy,
T  xz,
T  yx,
T  yy,
T  yz,
T  zx,
T  zy,
T  zz 
)
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
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
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

Member Data Documentation

union { ... }

An anonymous union to handle the various representations

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

The number of columns in the matrix.

template<typename T >
T gf::Matrix< T, 3, 3 >::data[9]

Array representation.

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

Grid representation.

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

The number of rows in the matrix.

template<typename T >
T gf::Matrix< T, 3, 3 >::xx
template<typename T >
T gf::Matrix< T, 3, 3 >::xy
template<typename T >
T gf::Matrix< T, 3, 3 >::xz
template<typename T >
T gf::Matrix< T, 3, 3 >::yx
template<typename T >
T gf::Matrix< T, 3, 3 >::yy
template<typename T >
T gf::Matrix< T, 3, 3 >::yz
template<typename T >
T gf::Matrix< T, 3, 3 >::zx
template<typename T >
T gf::Matrix< T, 3, 3 >::zy
template<typename T >
T gf::Matrix< T, 3, 3 >::zz