Gamedev Framework (gf)
0.3.0
A C++11 framework for 2D games
|
A 2x2 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 yx, T yy) |
Constructor that takes all the elements. More... | |
Public Attributes | |
union gf::Matrix< T, 2, 2 >:: { ... } | |
T | grid [2][2] |
Grid representation. More... | |
T | data [4] |
Array representation. More... | |
T | xx |
T | xy |
T | yx |
T | yy |
Static Public Attributes | |
static constexpr std::size_t | Rows = 2 |
The number of rows in the matrix. More... | |
static constexpr std::size_t | Cols = 2 |
The number of columns in the matrix. More... | |
A 2x2 matrix.
This specialization of gf::Matrix handles linear transformation of 2D vectors. As translation is not a linear transformation but an affine transformation, this specialization is not used in the library. Instead use a gf::Matrix<T, 3, 3>. It is provided for convinience.
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:
float
as T
using gf::Matrix< T, 2, 2 >::value_type = T |
The value type of the elements of the matrix.
|
default |
Default constructor.
Constructor that takes all the elements.
xx | The element in the first row and first column |
xy | The element in the first row and second column |
yx | The element in the second row and first column |
yy | The element in the second row and second column |
union { ... } |
An anonymous union to handle the various representations
|
static |
The number of columns in the matrix.
T gf::Matrix< T, 2, 2 >::data[4] |
Array representation.
T gf::Matrix< T, 2, 2 >::grid[2][2] |
Grid representation.
|
static |
The number of rows in the matrix.
T gf::Matrix< T, 2, 2 >::xx |
T gf::Matrix< T, 2, 2 >::xy |
T gf::Matrix< T, 2, 2 >::yx |
T gf::Matrix< T, 2, 2 >::yy |