![]() |
Gamedev Framework (gf) 1.2.0
A C++17 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 (ZeroType) noexcept |
constexpr | Matrix (T val) noexcept |
constexpr | Matrix (const T *array) |
constexpr | Matrix (T e11, T e12, T e21, T e22) noexcept |
Constructor that takes all the elements. More... | |
const T * | getData () const noexcept |
T * | getData () noexcept |
T | operator() (std::size_t row, std::size_t col) const |
T & | operator() (std::size_t row, std::size_t col) |
constexpr void | zero () noexcept |
Public Attributes | |
union gf::Matrix< T, 2, 2 >:: { ... } | |
union gf::Matrix< T, 2, 2 >:: { ... } | |
union gf::Matrix< T, 2, 2 >:: { ... } | |
union gf::Matrix< T, 2, 2 >:: { ... } | |
T | xx |
T | m11 |
T | xy |
T | m12 |
T | yx |
T | m21 |
T | yy |
T | m22 |
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.
|
inlineconstexprnoexcept |
|
inlineexplicitconstexprnoexcept |
|
inlineexplicitconstexpr |
|
inlineconstexprnoexcept |
Constructor that takes all the elements.
e11 | The element in the first row and first column |
e12 | The element in the first row and second column |
e21 | The element in the second row and first column |
e22 | The element in the second row and second column |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
|
inline |
|
inlineconstexprnoexcept |
union gf::Matrix< T, 2, 2 > { ... } gf::Matrix< T, 2, 2 >::@11 |
union gf::Matrix< T, 2, 2 > { ... } gf::Matrix< T, 2, 2 >::@13 |
union gf::Matrix< T, 2, 2 > { ... } gf::Matrix< T, 2, 2 >::@15 |
union gf::Matrix< T, 2, 2 > { ... } gf::Matrix< T, 2, 2 >::@9 |
|
staticconstexpr |
The number of columns in the matrix.
T gf::Matrix< T, 2, 2 >::m11 |
T gf::Matrix< T, 2, 2 >::m12 |
T gf::Matrix< T, 2, 2 >::m21 |
T gf::Matrix< T, 2, 2 >::m22 |
|
staticconstexpr |
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 |