Castor3D 0.16.0
Multiplatform 3D engine
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
castor::Matrix< T, Columns, Rows > Class Template Reference

Templated column major matrix representation. More...

#include <Matrix.hpp>

Inheritance diagram for castor::Matrix< T, Columns, Rows >:
Inheritance graph
[legend]

Public Types

using value_type = T
 
using col_type = Point< value_type, Rows >
 
using row_type = Point< value_type, Columns >
 
using transpose_type = Matrix< value_type, Rows, Columns >
 
using my_type = Matrix< value_type, Columns, Rows >
 

Public Member Functions

value_typeptr ()
 
value_type const * constPtr () const
 
void initialise ()
 Initialises the matrix to 0.
 
void initialise (value_type const &value)
 Initialises the matrix as a Jordan one, with the given value.
 
transpose_type getTransposed () const
 
void getTransposed (transpose_type &result) const
 Computes the transposed of this matrix.
 
value_type getTrace () const
 
void setIdentity ()
 sets this matrix to identity
 
 Matrix ()
 
 Matrix (NoInit const &)
 
 Matrix (Matrix const &matrix)
 
 Matrix (Matrix &&matrix) noexcept
 
 Matrix (T const &value)
 
 Matrix (T *matrix)
 
template<typename Type >
 Matrix (Type const *matrix)
 
template<typename Type >
 Matrix (Array< Type, Columns *Rows > const &rhs)
 
template<typename Type >
 Matrix (Matrix< Type, Columns, Rows > const &matrix)
 
 Matrix (std::initializer_list< T > rhs)
 
 ~Matrix () noexcept=default
 
template<typename ... Types>
requires isRightSize< Types... >
 Matrix (Types &&... inits)
 
void setRow (uint32_t index, value_type const *row)
 
void setRow (uint32_t index, Point< value_type, Columns > const &row)
 
void setRow (uint32_t index, Coords< value_type, Columns > const &row)
 
Point< value_type, Columns > getRow (uint32_t index) const
 
void getRow (uint32_t index, Point< value_type, Columns > &result) const
 
void setColumn (uint32_t index, value_type const *col)
 
void setColumn (uint32_t index, Point< value_type, Rows > const &col)
 
void setColumn (uint32_t index, Coords< value_type const, Rows > const &col)
 
void setColumn (uint32_t index, Coords< value_type, Rows > const &col)
 
Point< value_type, Rows > const & getColumn (uint32_t index) const
 
Point< value_type, Rows > & getColumn (uint32_t index)
 
void getColumn (uint32_t index, Point< value_type, Rows > &result) const
 
void getColumn (uint32_t index, Coords< value_type, Rows > &result)
 
col_type const & operator[] (uint32_t index) const
 
col_typeoperator[] (uint32_t index)
 
value_typeoperator() (uint32_t col, uint32_t row)
 
value_type const & operator() (uint32_t col, uint32_t row) const
 
Matrix< T, Columns, Rows > & operator= (Matrix< T, Columns, Rows > const &rhs)
 
Matrix< T, Columns, Rows > & operator= (Matrix< T, Columns, Rows > &&rhs) noexcept
 
template<typename Type >
Matrix< T, Columns, Rows > & operator= (Matrix< Type, Columns, Rows > const &rhs)
 
template<typename Type >
Matrix< T, Columns, Rows > & operator= (Type const *rhs)
 
template<typename Type >
Matrix< T, Columns, Rows > & operator+= (Matrix< Type, Columns, Rows > const &rhs)
 
template<typename Type >
Matrix< T, Columns, Rows > & operator-= (Matrix< Type, Columns, Rows > const &rhs)
 
Matrix< T, Columns, Rows > & operator+= (T const &rhs)
 
Matrix< T, Columns, Rows > & operator-= (T const &rhs)
 
Matrix< T, Columns, Rows > & operator*= (T const &rhs)
 
Matrix< T, Columns, Rows > & operator/= (T const &rhs)
 

Static Public Member Functions

static my_type getIdentity ()
 

Protected Member Functions

my_type recGetMinor (uint32_t x, uint32_t y, uint32_t rows, uint32_t cols) const
 

Protected Attributes

union { 
 
   Array< T, Columns *Rows >   m_data 
 
   Array< col_type, Columns >   m_columns 
 
};  
 

Static Protected Attributes

static const std::size_t count = Rows * Columns
 
static const std::size_t size = sizeof( T ) * Rows * Columns
 
template<typename ... Types>
static bool constexpr isRightSize = sizeof...( Types ) == count
 

Friends

template<typename U , uint32_t C, uint32_t R>
class Matrix
 

Detailed Description

template<typename T, uint32_t Columns, uint32_t Rows>
class castor::Matrix< T, Columns, Rows >

Templated column major matrix representation.

Remarks
Can hold any type which has a defined Policy.

Member Typedef Documentation

◆ col_type

template<typename T , uint32_t Columns, uint32_t Rows>
using castor::Matrix< T, Columns, Rows >::col_type = Point< value_type, Rows >

The column type

◆ my_type

template<typename T , uint32_t Columns, uint32_t Rows>
using castor::Matrix< T, Columns, Rows >::my_type = Matrix< value_type, Columns, Rows >

This matrix type.

◆ row_type

template<typename T , uint32_t Columns, uint32_t Rows>
using castor::Matrix< T, Columns, Rows >::row_type = Point< value_type, Columns >

The line type.

◆ transpose_type

template<typename T , uint32_t Columns, uint32_t Rows>
using castor::Matrix< T, Columns, Rows >::transpose_type = Matrix< value_type, Rows, Columns >

The transposed matrix type.

◆ value_type

template<typename T , uint32_t Columns, uint32_t Rows>
using castor::Matrix< T, Columns, Rows >::value_type = T

The data type.

Constructor & Destructor Documentation

◆ Matrix() [1/11]

template<typename T , uint32_t Columns, uint32_t Rows>
castor::Matrix< T, Columns, Rows >::Matrix ( )

name Construction / Destruction.

◆ Matrix() [2/11]

template<typename T , uint32_t Columns, uint32_t Rows>
castor::Matrix< T, Columns, Rows >::Matrix ( NoInit const & )
explicit

◆ Matrix() [3/11]

template<typename T , uint32_t Columns, uint32_t Rows>
castor::Matrix< T, Columns, Rows >::Matrix ( Matrix< T, Columns, Rows > const & matrix)

◆ Matrix() [4/11]

template<typename T , uint32_t Columns, uint32_t Rows>
castor::Matrix< T, Columns, Rows >::Matrix ( Matrix< T, Columns, Rows > && matrix)
noexcept

◆ Matrix() [5/11]

template<typename T , uint32_t Columns, uint32_t Rows>
castor::Matrix< T, Columns, Rows >::Matrix ( T const & value)
explicit

◆ Matrix() [6/11]

template<typename T , uint32_t Columns, uint32_t Rows>
castor::Matrix< T, Columns, Rows >::Matrix ( T * matrix)
explicit

◆ Matrix() [7/11]

template<typename T , uint32_t Columns, uint32_t Rows>
template<typename Type >
castor::Matrix< T, Columns, Rows >::Matrix ( Type const * matrix)
explicit

◆ Matrix() [8/11]

template<typename T , uint32_t Columns, uint32_t Rows>
template<typename Type >
castor::Matrix< T, Columns, Rows >::Matrix ( Array< Type, Columns *Rows > const & rhs)
explicit

◆ Matrix() [9/11]

template<typename T , uint32_t Columns, uint32_t Rows>
template<typename Type >
castor::Matrix< T, Columns, Rows >::Matrix ( Matrix< Type, Columns, Rows > const & matrix)
explicit

◆ Matrix() [10/11]

template<typename T , uint32_t Columns, uint32_t Rows>
castor::Matrix< T, Columns, Rows >::Matrix ( std::initializer_list< T > rhs)
explicit

◆ ~Matrix()

template<typename T , uint32_t Columns, uint32_t Rows>
castor::Matrix< T, Columns, Rows >::~Matrix ( )
defaultnoexcept

◆ Matrix() [11/11]

template<typename T , uint32_t Columns, uint32_t Rows>
template<typename ... Types>
requires isRightSize< Types... >
castor::Matrix< T, Columns, Rows >::Matrix ( Types &&... inits)
inlineexplicit

Member Function Documentation

◆ constPtr()

template<typename T , uint32_t Columns, uint32_t Rows>
value_type const * castor::Matrix< T, Columns, Rows >::constPtr ( ) const
Returns
The pointer on constant datas.

◆ getColumn() [1/4]

template<typename T , uint32_t Columns, uint32_t Rows>
Point< value_type, Rows > & castor::Matrix< T, Columns, Rows >::getColumn ( uint32_t index)

◆ getColumn() [2/4]

template<typename T , uint32_t Columns, uint32_t Rows>
Point< value_type, Rows > const & castor::Matrix< T, Columns, Rows >::getColumn ( uint32_t index) const

◆ getColumn() [3/4]

template<typename T , uint32_t Columns, uint32_t Rows>
void castor::Matrix< T, Columns, Rows >::getColumn ( uint32_t index,
Coords< value_type, Rows > & result )

◆ getColumn() [4/4]

template<typename T , uint32_t Columns, uint32_t Rows>
void castor::Matrix< T, Columns, Rows >::getColumn ( uint32_t index,
Point< value_type, Rows > & result ) const

◆ getIdentity()

template<typename T , uint32_t Columns, uint32_t Rows>
static my_type castor::Matrix< T, Columns, Rows >::getIdentity ( )
static
Returns
The identity matrix.

◆ getRow() [1/2]

template<typename T , uint32_t Columns, uint32_t Rows>
Point< value_type, Columns > castor::Matrix< T, Columns, Rows >::getRow ( uint32_t index) const

◆ getRow() [2/2]

template<typename T , uint32_t Columns, uint32_t Rows>
void castor::Matrix< T, Columns, Rows >::getRow ( uint32_t index,
Point< value_type, Columns > & result ) const

◆ getTrace()

template<typename T , uint32_t Columns, uint32_t Rows>
value_type castor::Matrix< T, Columns, Rows >::getTrace ( ) const
Returns
The trace or this matrix.

◆ getTransposed() [1/2]

template<typename T , uint32_t Columns, uint32_t Rows>
transpose_type castor::Matrix< T, Columns, Rows >::getTransposed ( ) const
Returns
The transposed of this matrix.

◆ getTransposed() [2/2]

template<typename T , uint32_t Columns, uint32_t Rows>
void castor::Matrix< T, Columns, Rows >::getTransposed ( transpose_type & result) const

Computes the transposed of this matrix.

Parameters
[in]resultReceives the transposed.

◆ initialise() [1/2]

template<typename T , uint32_t Columns, uint32_t Rows>
void castor::Matrix< T, Columns, Rows >::initialise ( )

Initialises the matrix to 0.

◆ initialise() [2/2]

template<typename T , uint32_t Columns, uint32_t Rows>
void castor::Matrix< T, Columns, Rows >::initialise ( value_type const & value)

Initialises the matrix as a Jordan one, with the given value.

Parameters
[in]valueThe value.

◆ operator()() [1/2]

template<typename T , uint32_t Columns, uint32_t Rows>
value_type & castor::Matrix< T, Columns, Rows >::operator() ( uint32_t col,
uint32_t row )

◆ operator()() [2/2]

template<typename T , uint32_t Columns, uint32_t Rows>
value_type const & castor::Matrix< T, Columns, Rows >::operator() ( uint32_t col,
uint32_t row ) const

◆ operator*=()

template<typename T , uint32_t Columns, uint32_t Rows>
Matrix< T, Columns, Rows > & castor::Matrix< T, Columns, Rows >::operator*= ( T const & rhs)

◆ operator+=() [1/2]

template<typename T , uint32_t Columns, uint32_t Rows>
template<typename Type >
Matrix< T, Columns, Rows > & castor::Matrix< T, Columns, Rows >::operator+= ( Matrix< Type, Columns, Rows > const & rhs)

name Arithmetic operators.

◆ operator+=() [2/2]

template<typename T , uint32_t Columns, uint32_t Rows>
Matrix< T, Columns, Rows > & castor::Matrix< T, Columns, Rows >::operator+= ( T const & rhs)

◆ operator-=() [1/2]

template<typename T , uint32_t Columns, uint32_t Rows>
template<typename Type >
Matrix< T, Columns, Rows > & castor::Matrix< T, Columns, Rows >::operator-= ( Matrix< Type, Columns, Rows > const & rhs)

◆ operator-=() [2/2]

template<typename T , uint32_t Columns, uint32_t Rows>
Matrix< T, Columns, Rows > & castor::Matrix< T, Columns, Rows >::operator-= ( T const & rhs)

◆ operator/=()

template<typename T , uint32_t Columns, uint32_t Rows>
Matrix< T, Columns, Rows > & castor::Matrix< T, Columns, Rows >::operator/= ( T const & rhs)

◆ operator=() [1/4]

template<typename T , uint32_t Columns, uint32_t Rows>
Matrix< T, Columns, Rows > & castor::Matrix< T, Columns, Rows >::operator= ( Matrix< T, Columns, Rows > && rhs)
noexcept

◆ operator=() [2/4]

template<typename T , uint32_t Columns, uint32_t Rows>
Matrix< T, Columns, Rows > & castor::Matrix< T, Columns, Rows >::operator= ( Matrix< T, Columns, Rows > const & rhs)

name Assignment operators.

◆ operator=() [3/4]

template<typename T , uint32_t Columns, uint32_t Rows>
template<typename Type >
Matrix< T, Columns, Rows > & castor::Matrix< T, Columns, Rows >::operator= ( Matrix< Type, Columns, Rows > const & rhs)

◆ operator=() [4/4]

template<typename T , uint32_t Columns, uint32_t Rows>
template<typename Type >
Matrix< T, Columns, Rows > & castor::Matrix< T, Columns, Rows >::operator= ( Type const * rhs)

◆ operator[]() [1/2]

template<typename T , uint32_t Columns, uint32_t Rows>
col_type & castor::Matrix< T, Columns, Rows >::operator[] ( uint32_t index)

◆ operator[]() [2/2]

template<typename T , uint32_t Columns, uint32_t Rows>
col_type const & castor::Matrix< T, Columns, Rows >::operator[] ( uint32_t index) const

name Array access.

◆ ptr()

template<typename T , uint32_t Columns, uint32_t Rows>
value_type * castor::Matrix< T, Columns, Rows >::ptr ( )
Returns
The pointer on datas.

◆ recGetMinor()

template<typename T , uint32_t Columns, uint32_t Rows>
my_type castor::Matrix< T, Columns, Rows >::recGetMinor ( uint32_t x,
uint32_t y,
uint32_t rows,
uint32_t cols ) const
protected

◆ setColumn() [1/4]

template<typename T , uint32_t Columns, uint32_t Rows>
void castor::Matrix< T, Columns, Rows >::setColumn ( uint32_t index,
Coords< value_type const, Rows > const & col )

◆ setColumn() [2/4]

template<typename T , uint32_t Columns, uint32_t Rows>
void castor::Matrix< T, Columns, Rows >::setColumn ( uint32_t index,
Coords< value_type, Rows > const & col )

◆ setColumn() [3/4]

template<typename T , uint32_t Columns, uint32_t Rows>
void castor::Matrix< T, Columns, Rows >::setColumn ( uint32_t index,
Point< value_type, Rows > const & col )

◆ setColumn() [4/4]

template<typename T , uint32_t Columns, uint32_t Rows>
void castor::Matrix< T, Columns, Rows >::setColumn ( uint32_t index,
value_type const * col )

◆ setIdentity()

template<typename T , uint32_t Columns, uint32_t Rows>
void castor::Matrix< T, Columns, Rows >::setIdentity ( )

sets this matrix to identity

◆ setRow() [1/3]

template<typename T , uint32_t Columns, uint32_t Rows>
void castor::Matrix< T, Columns, Rows >::setRow ( uint32_t index,
Coords< value_type, Columns > const & row )

◆ setRow() [2/3]

template<typename T , uint32_t Columns, uint32_t Rows>
void castor::Matrix< T, Columns, Rows >::setRow ( uint32_t index,
Point< value_type, Columns > const & row )

◆ setRow() [3/3]

template<typename T , uint32_t Columns, uint32_t Rows>
void castor::Matrix< T, Columns, Rows >::setRow ( uint32_t index,
value_type const * row )

name Row/column access.

Friends And Related Symbol Documentation

◆ Matrix

template<typename T , uint32_t Columns, uint32_t Rows>
template<typename U , uint32_t C, uint32_t R>
friend class Matrix
friend

Member Data Documentation

◆ [union]

union { ... } castor::Matrix< T, Columns, Rows >

◆ count

template<typename T , uint32_t Columns, uint32_t Rows>
const std::size_t castor::Matrix< T, Columns, Rows >::count = Rows * Columns
staticprotected

◆ isRightSize

template<typename T , uint32_t Columns, uint32_t Rows>
template<typename ... Types>
bool constexpr castor::Matrix< T, Columns, Rows >::isRightSize = sizeof...( Types ) == count
staticconstexprprotected

◆ m_columns

template<typename T , uint32_t Columns, uint32_t Rows>
Array< col_type, Columns > castor::Matrix< T, Columns, Rows >::m_columns

◆ m_data

template<typename T , uint32_t Columns, uint32_t Rows>
Array< T, Columns * Rows > castor::Matrix< T, Columns, Rows >::m_data

◆ size

template<typename T , uint32_t Columns, uint32_t Rows>
const std::size_t castor::Matrix< T, Columns, Rows >::size = sizeof( T ) * Rows * Columns
staticprotected

The documentation for this class was generated from the following files: