Gamedev Framework (gf) 1.2.0
A C++17 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 (ZeroType) noexcept
 
constexpr Matrix (T val) noexcept
 
constexpr Matrix (const T *array)
 
constexpr Matrix (T e11, T e12, T e13, T e21, T e22, T e23, T e31, T e32, T e33) noexcept
 Constructor that takes all the elements. More...
 
const T * getData () const noexcept
 
T * getData () noexcept
 
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, 3, 3 >:: { ... }  
 
union gf::Matrix< T, 3, 3 >:: { ... }  
 
union gf::Matrix< T, 3, 3 >:: { ... }  
 
union gf::Matrix< T, 3, 3 >:: { ... }  
 
union gf::Matrix< T, 3, 3 >:: { ... }  
 
union gf::Matrix< T, 3, 3 >:: { ... }  
 
union gf::Matrix< T, 3, 3 >:: { ... }  
 
union gf::Matrix< T, 3, 3 >:: { ... }  
 
union gf::Matrix< T, 3, 3 >:: { ... }  
 
xx
 
m11
 
xy
 
m12
 
xz
 
m13
 
yx
 
m21
 
yy
 
m22
 
yz
 
m23
 
zx
 
m31
 
zy
 
m32
 
zz
 
m33
 

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

◆ value_type

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

The value type of the elements of the matrix.

Constructor & Destructor Documentation

◆ Matrix() [1/5]

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

Default constructor.

◆ Matrix() [2/5]

template<typename T >
constexpr gf::Matrix< T, 3, 3 >::Matrix ( ZeroType  )
inlineconstexprnoexcept

◆ Matrix() [3/5]

template<typename T >
constexpr gf::Matrix< T, 3, 3 >::Matrix ( val)
inlineexplicitconstexprnoexcept

◆ Matrix() [4/5]

template<typename T >
constexpr gf::Matrix< T, 3, 3 >::Matrix ( const T *  array)
inlineexplicitconstexpr

◆ Matrix() [5/5]

template<typename T >
constexpr gf::Matrix< T, 3, 3 >::Matrix ( e11,
e12,
e13,
e21,
e22,
e23,
e31,
e32,
e33 
)
inlineconstexprnoexcept

Constructor that takes all the elements.

Parameters
e11The element in the first row and first column
e12The element in the first row and second column
e13The element in the first row and third column
e21The element in the second row and first column
e22The element in the second row and second column
e23The element in the second row and third column
e31The element in the third row and first column
e32The element in the third row and second column
e33The element in the third row and third column

Member Function Documentation

◆ getData() [1/2]

template<typename T >
const T * gf::Matrix< T, 3, 3 >::getData ( ) const
inlinenoexcept

◆ getData() [2/2]

template<typename T >
T * gf::Matrix< T, 3, 3 >::getData ( )
inlinenoexcept

◆ operator()() [1/2]

template<typename T >
T & gf::Matrix< T, 3, 3 >::operator() ( std::size_t  row,
std::size_t  col 
)
inline

◆ operator()() [2/2]

template<typename T >
T gf::Matrix< T, 3, 3 >::operator() ( std::size_t  row,
std::size_t  col 
) const
inline

◆ zero()

template<typename T >
constexpr void gf::Matrix< T, 3, 3 >::zero ( )
inlineconstexprnoexcept

Member Data Documentation

◆ 

union gf::Matrix< T, 3, 3 > { ... } gf::Matrix< T, 3, 3 >::@17

◆ 

union gf::Matrix< T, 3, 3 > { ... } gf::Matrix< T, 3, 3 >::@19

◆ 

union gf::Matrix< T, 3, 3 > { ... } gf::Matrix< T, 3, 3 >::@21

◆ 

union gf::Matrix< T, 3, 3 > { ... } gf::Matrix< T, 3, 3 >::@23

◆ 

union gf::Matrix< T, 3, 3 > { ... } gf::Matrix< T, 3, 3 >::@25

◆ 

union gf::Matrix< T, 3, 3 > { ... } gf::Matrix< T, 3, 3 >::@27

◆ 

union gf::Matrix< T, 3, 3 > { ... } gf::Matrix< T, 3, 3 >::@29

◆ 

union gf::Matrix< T, 3, 3 > { ... } gf::Matrix< T, 3, 3 >::@31

◆ 

union gf::Matrix< T, 3, 3 > { ... } gf::Matrix< T, 3, 3 >::@33

◆ Cols

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

The number of columns in the matrix.

◆ m11

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

◆ m12

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

◆ m13

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

◆ m21

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

◆ m22

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

◆ m23

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

◆ m31

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

◆ m32

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

◆ m33

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

◆ Rows

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

The number of rows in the matrix.

◆ xx

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

◆ xy

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

◆ xz

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

◆ yx

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

◆ yy

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

◆ yz

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

◆ zx

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

◆ zy

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

◆ zz

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