Gamedev Framework (gf)  0.7.0
A C++14 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 TgetData () const noexcept
 
TgetData () noexcept
 
T operator() (std::size_t row, std::size_t col) const
 
Toperator() (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 >:: { ... }  
 
T xx
 
T m11
 
T xy
 
T m12
 
T xz
 
T m13
 
T yx
 
T m21
 
T yy
 
T m22
 
T yz
 
T m23
 
T zx
 
T m31
 
T zy
 
T m32
 
T zz
 
T 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  )
inlinenoexcept

◆ Matrix() [3/5]

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

◆ Matrix() [4/5]

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

◆ Matrix() [5/5]

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

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 
) const
inline

◆ operator()() [2/2]

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

◆ zero()

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

Member Data Documentation

◆ @14

union { ... }

◆ @16

union { ... }

◆ @18

union { ... }

◆ @20

union { ... }

◆ @22

union { ... }

◆ @24

union { ... }

◆ @26

union { ... }

◆ @28

union { ... }

◆ @30

union { ... }

◆ Cols

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

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
static

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