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, 4, 4 > Struct Template Reference

A 4x4 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 e14, T e21, T e22, T e23, T e24, T e31, T e32, T e33, T e34, T e41, T e42, T e43, T e44) 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, 4, 4 >:: { ... }  
 
union gf::Matrix< T, 4, 4 >:: { ... }  
 
union gf::Matrix< T, 4, 4 >:: { ... }  
 
union gf::Matrix< T, 4, 4 >:: { ... }  
 
union gf::Matrix< T, 4, 4 >:: { ... }  
 
union gf::Matrix< T, 4, 4 >:: { ... }  
 
union gf::Matrix< T, 4, 4 >:: { ... }  
 
union gf::Matrix< T, 4, 4 >:: { ... }  
 
union gf::Matrix< T, 4, 4 >:: { ... }  
 
union gf::Matrix< T, 4, 4 >:: { ... }  
 
union gf::Matrix< T, 4, 4 >:: { ... }  
 
union gf::Matrix< T, 4, 4 >:: { ... }  
 
union gf::Matrix< T, 4, 4 >:: { ... }  
 
union gf::Matrix< T, 4, 4 >:: { ... }  
 
union gf::Matrix< T, 4, 4 >:: { ... }  
 
union gf::Matrix< T, 4, 4 >:: { ... }  
 
T xx
 
T m11
 
T xy
 
T m12
 
T xz
 
T m13
 
T xw
 
T m14
 
T yx
 
T m21
 
T yy
 
T m22
 
T yz
 
T m23
 
T yw
 
T m24
 
T zx
 
T m31
 
T zy
 
T m32
 
T zz
 
T m33
 
T zw
 
T m34
 
T wx
 
T m41
 
T wy
 
T m42
 
T wz
 
T m43
 
T ww
 
T m44
 

Static Public Attributes

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

Detailed Description

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

A 4x4 matrix.

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

Member Typedef Documentation

◆ value_type

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

The value type of the elements of the matrix.

Constructor & Destructor Documentation

◆ Matrix() [1/5]

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

Default constructor.

◆ Matrix() [2/5]

template<typename T >
constexpr gf::Matrix< T, 4, 4 >::Matrix ( ZeroType  )
inlinenoexcept

◆ Matrix() [3/5]

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

◆ Matrix() [4/5]

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

◆ Matrix() [5/5]

template<typename T >
constexpr gf::Matrix< T, 4, 4 >::Matrix ( T  e11,
T  e12,
T  e13,
T  e14,
T  e21,
T  e22,
T  e23,
T  e24,
T  e31,
T  e32,
T  e33,
T  e34,
T  e41,
T  e42,
T  e43,
T  e44 
)
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
e14The element in the first row and fourth 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
e24The element in the second row and fourth 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
e34The element in the third row and fourth column
e41The element in the fourth row and first column
e42The element in the fourth row and second column
e43The element in the fourth row and third column
e44The element in the fourth row and fourth column

Member Function Documentation

◆ getData() [1/2]

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

◆ getData() [2/2]

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

◆ operator()() [1/2]

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

◆ operator()() [2/2]

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

◆ zero()

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

Member Data Documentation

◆ @32

union { ... }

◆ @34

union { ... }

◆ @36

union { ... }

◆ @38

union { ... }

◆ @40

union { ... }

◆ @42

union { ... }

◆ @44

union { ... }

◆ @46

union { ... }

◆ @48

union { ... }

◆ @50

union { ... }

◆ @52

union { ... }

◆ @54

union { ... }

◆ @56

union { ... }

◆ @58

union { ... }

◆ @60

union { ... }

◆ @62

union { ... }

◆ Cols

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

The number of columns in the matrix.

◆ m11

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

◆ m12

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

◆ m13

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

◆ m14

template<typename T >
T gf::Matrix< T, 4, 4 >::m14

◆ m21

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

◆ m22

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

◆ m23

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

◆ m24

template<typename T >
T gf::Matrix< T, 4, 4 >::m24

◆ m31

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

◆ m32

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

◆ m33

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

◆ m34

template<typename T >
T gf::Matrix< T, 4, 4 >::m34

◆ m41

template<typename T >
T gf::Matrix< T, 4, 4 >::m41

◆ m42

template<typename T >
T gf::Matrix< T, 4, 4 >::m42

◆ m43

template<typename T >
T gf::Matrix< T, 4, 4 >::m43

◆ m44

template<typename T >
T gf::Matrix< T, 4, 4 >::m44

◆ Rows

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

The number of rows in the matrix.

◆ ww

template<typename T >
T gf::Matrix< T, 4, 4 >::ww

◆ wx

template<typename T >
T gf::Matrix< T, 4, 4 >::wx

◆ wy

template<typename T >
T gf::Matrix< T, 4, 4 >::wy

◆ wz

template<typename T >
T gf::Matrix< T, 4, 4 >::wz

◆ xw

template<typename T >
T gf::Matrix< T, 4, 4 >::xw

◆ xx

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

◆ xy

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

◆ xz

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

◆ yw

template<typename T >
T gf::Matrix< T, 4, 4 >::yw

◆ yx

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

◆ yy

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

◆ yz

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

◆ zw

template<typename T >
T gf::Matrix< T, 4, 4 >::zw

◆ zx

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

◆ zy

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

◆ zz

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