FastUIDraw
Public Types | Public Member Functions | List of all members
fastuidraw::matrix3x3< T > Class Template Reference

A representation of a 3x3 matrix, that in addition to the NxN matrix functionality provides function for calculating the determinant. More...

#include <matrix.hpp>

Inheritance diagram for fastuidraw::matrix3x3< T >:
Inheritance graph
[legend]

Public Types

typedef matrixNxM< 3, 3, T > base_class
 Conveniance typedef to base class, matrixNxM<3, 3, T>
 
- Public Types inherited from fastuidraw::matrixNxM< 3, 3, T >
enum  
 
typedef vecN< T, N *M > raw_data_type
 Typedef to underlying vecN that holds the matrix data.
 

Public Member Functions

 matrix3x3 (void)
 
 matrix3x3 (const base_class &obj)
 
 matrix3x3 (const vecN< T, 3 > &t, const vecN< T, 3 > &b, const vecN< T, 3 > &n)
 
 matrix3x3 (const matrixNxM< 2, 2, T > &mat, const vecN< T, 2 > &vec=vecN< T, 2 >(T(0)))
 
 matrix3x3 (const orthogonal_projection_params< T > &P)
 
 matrix3x3 (const projection_params< T > &P)
 
void cofactor (matrix3x3 &result) const
 
void cofactor_transpose (matrix3x3 &result) const
 
determinate (void) const
 
void inverse (matrix3x3 &result) const
 
void inverse_orthogonal_projection_matrix (const orthogonal_projection_params< T > &P)
 
void inverse_transpose (matrix3x3 &result) const
 
void orthogonal_projection_matrix (const orthogonal_projection_params< T > &P)
 
void orthogonal_projection_matrix (T l, T r, T b, T t)
 
void projection_matrix (const projection_params< T > &P)
 
bool reverses_orientation (void) const
 
void rotate (T angle)
 
void scale (T s)
 
void shear (T sx, T sy)
 
void translate (T x, T y)
 
void translate (const vecN< T, 2 > &p)
 
- Public Member Functions inherited from fastuidraw::matrixNxM< 3, 3, T >
 matrixNxM (const matrixNxM &obj)
 
 matrixNxM (void)
 
T * c_ptr (void)
 
const T * c_ptr (void) const
 
T & col_row (unsigned int col, unsigned row)
 
const T & col_row (unsigned int col, unsigned row) const
 
T & operator() (unsigned int row, unsigned int col)
 
const T & operator() (unsigned int row, unsigned int col) const
 
matrixNxM operator* (T value) const
 
matrixNxM< N, K, T > operator* (const matrixNxM< M, K, T > &matrix) const
 
vecN< T, N > operator* (const vecN< T, M > &in) const
 
matrixNxM operator+ (const matrixNxM &matrix) const
 
matrixNxM operator- (const matrixNxM &matrix) const
 
vecN< T, N *M > & raw_data (void)
 
const vecN< T, N *M > & raw_data (void) const
 
void reset (void)
 
void swap (matrixNxM &obj)
 
void transpose (matrixNxM< M, N, T > &retval) const
 
matrixNxM< M, N, T > transpose (void) const
 

Detailed Description

template<typename T>
class fastuidraw::matrix3x3< T >

A representation of a 3x3 matrix, that in addition to the NxN matrix functionality provides function for calculating the determinant.

Definition at line 440 of file matrix.hpp.

Constructor & Destructor Documentation

◆ matrix3x3() [1/6]

template<typename T>
fastuidraw::matrix3x3< T >::matrix3x3 ( void  )
inline

Initializes the 3x3 matrix as the identity, i.e. diagnols are 1 and other values are 0.

Definition at line 453 of file matrix.hpp.

◆ matrix3x3() [2/6]

template<typename T>
fastuidraw::matrix3x3< T >::matrix3x3 ( const base_class obj)
inline

Copy-constructor for a 3x3 matrix.

Parameters
objtarget matrix to copy.

Definition at line 459 of file matrix.hpp.

◆ matrix3x3() [3/6]

template<typename T>
fastuidraw::matrix3x3< T >::matrix3x3 ( const vecN< T, 3 > &  t,
const vecN< T, 3 > &  b,
const vecN< T, 3 > &  n 
)
inline

Construct a matrix3x3 M so that

  • M*vecN<T, 3>(1, 0, 0)=T
  • M*vecN<T, 3>(0, 1, 0)=B
  • M*vecN<T, 3>(0, 0, 1)=N
    Parameters
    tfirst row vector
    bsecond row vector
    nthird row vector

Definition at line 470 of file matrix.hpp.

◆ matrix3x3() [4/6]

template<typename T>
fastuidraw::matrix3x3< T >::matrix3x3 ( const matrixNxM< 2, 2, T > &  mat,
const vecN< T, 2 > &  vec = vecN<T, 2>(T(0)) 
)
inline

Initialize the 3x3 matrix with the upper 2x2 corner coming from a 2x2 martix and the right column coming from a 2-vector. The bottom is initialized as 0 in first and second column and bottom right as 1.

Definition at line 486 of file matrix.hpp.

◆ matrix3x3() [5/6]

template<typename T>
fastuidraw::matrix3x3< T >::matrix3x3 ( const orthogonal_projection_params< T > &  P)
inline

fn matrix3x3(const orthogonal_projection_params<T>&) Creates a 3x3 orthogonal projection matrix from the given projection parameters.

Parameters
Porthogonal projection parameters for the matrix

Definition at line 505 of file matrix.hpp.

◆ matrix3x3() [6/6]

template<typename T>
fastuidraw::matrix3x3< T >::matrix3x3 ( const projection_params< T > &  P)
inline

fn matrix3x3(const orthogonal_projection_params<T>&) Creates a 3x3 projection matrix from the given projection parameters.

Parameters
Pprojection parameters for the matrix

Definition at line 516 of file matrix.hpp.

Member Function Documentation

◆ cofactor()

template<typename T>
void fastuidraw::matrix3x3< T >::cofactor ( matrix3x3< T > &  result) const
inline

Compute the cofactor matrix

Parameters
resultlocation to which to place the cofactor matrx

Definition at line 746 of file matrix.hpp.

◆ cofactor_transpose()

template<typename T>
void fastuidraw::matrix3x3< T >::cofactor_transpose ( matrix3x3< T > &  result) const
inline

Compute the transpose of the cofactor matrix

Parameters
resultlocation to which to place the cofactor matrx

Definition at line 727 of file matrix.hpp.

◆ determinate()

template<typename T>
T fastuidraw::matrix3x3< T >::determinate ( void  ) const
inline

Calculates the determinant for the matrix.

Definition at line 714 of file matrix.hpp.

◆ inverse()

template<typename T>
void fastuidraw::matrix3x3< T >::inverse ( matrix3x3< T > &  result) const
inline

Compute the inverse of a matrix.

Parameters
resultlocation to which to place the inverse matrix

Definition at line 765 of file matrix.hpp.

◆ inverse_orthogonal_projection_matrix()

template<typename T>
void fastuidraw::matrix3x3< T >::inverse_orthogonal_projection_matrix ( const orthogonal_projection_params< T > &  P)
inline

Sets the matrix variables to correspond the inverse to an orthogonal projection matrix determined by the given projection parameters.

Parameters
Porthogonal projection parameters for this matrix

Definition at line 661 of file matrix.hpp.

◆ inverse_transpose()

template<typename T>
void fastuidraw::matrix3x3< T >::inverse_transpose ( matrix3x3< T > &  result) const
inline

Compute the inverse transpose of a matrix.

Parameters
resultlocation to which to place the inverse matrix

Definition at line 780 of file matrix.hpp.

◆ orthogonal_projection_matrix() [1/2]

template<typename T>
void fastuidraw::matrix3x3< T >::orthogonal_projection_matrix ( const orthogonal_projection_params< T > &  P)
inline

Sets the matrix variables to correspond an orthogonal projection matrix determined by the given projection parameters.

Parameters
Porthogonal projection parameters for this matrix

Definition at line 639 of file matrix.hpp.

◆ orthogonal_projection_matrix() [2/2]

template<typename T>
void fastuidraw::matrix3x3< T >::orthogonal_projection_matrix ( l,
r,
b,
t 
)
inline

Convenience function to matrix3x3::orthogonal_projection_matrix(const project_params<T>&).

Parameters
lLeft
rRight
bBottom
tTop

Definition at line 684 of file matrix.hpp.

◆ projection_matrix()

template<typename T>
void fastuidraw::matrix3x3< T >::projection_matrix ( const projection_params< T > &  P)
inline

Sets the matrix values to correspond the projection matrix determined by the given projection parameters.

Parameters
Pprojection parameters for this matrix

Definition at line 695 of file matrix.hpp.

◆ reverses_orientation()

template<typename T>
bool fastuidraw::matrix3x3< T >::reverses_orientation ( void  ) const
inline

Checks whether the matrix reverses orientation. This check is equivalent to determinant < T(0).

Definition at line 795 of file matrix.hpp.

◆ rotate()

template<typename T>
void fastuidraw::matrix3x3< T >::rotate ( angle)
inline

Apply a rotation matrix on the right of the matrix, algebraicly equivalent to

s = t_sin(angle);
c = t_cos(angle);
M(0, 0) = c;
M(1, 0) = s;
M(0, 1) = -s;
M(1, 1) = c;
*this = *this * M;
Parameters
angleamount by which to rotate in radians.

Definition at line 605 of file matrix.hpp.

◆ scale()

template<typename T>
void fastuidraw::matrix3x3< T >::scale ( s)
inline

Apply scale on the right of the matrix, algebraicly equivalent to

M(0, 0) = s;
M(1, 1) = s;
*this = *this * M;

Definition at line 553 of file matrix.hpp.

◆ shear()

template<typename T>
void fastuidraw::matrix3x3< T >::shear ( sx,
sy 
)
inline

Apply shear on the right of the matrix, algebraicly equivalent to

M(0, 0) = sx;
M(1, 1) = sy;
*this = *this * M;

Definition at line 532 of file matrix.hpp.

◆ translate() [1/2]

template<typename T>
void fastuidraw::matrix3x3< T >::translate ( x,
y 
)
inline

Apply translate on the right of the matrix, algebraicly equivalent to

M(0, 2) = x;
M(1, 2) = y;
*this = *this * M;
Parameters
xamount by which to translate horizontally
yamount by which to translate vertically

Definition at line 570 of file matrix.hpp.

◆ translate() [2/2]

template<typename T>
void fastuidraw::matrix3x3< T >::translate ( const vecN< T, 2 > &  p)
inline

Provided as an override conveniance, equivalent to

translate(p.x(), p.y())
Parameters
pamount by which to translate

Definition at line 585 of file matrix.hpp.


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