ML Reference
ml::Tmat4< DT > Class Template Reference

A four by four matrix class consisting of 4 row vectors. More...

#include <mlMatrix4.h>

Inheritance diagram for ml::Tmat4< DT >:
ml::FloatingPointMatrix< Tvec4< DT >, 4 >

Public Types

typedef DT ComponentType
 A typedef to "export" the type of components.
 
- Public Types inherited from ml::FloatingPointMatrix< Tvec4< DT >, 4 >
enum  
 This enum grants access to the row count during compile time, e.g. More...
 
enum  
 This enum grants access to the row count during compile time, e.g. More...
 
enum  
 This enum grants access to the number of values in the matrix, e.g. More...
 
typedef VectorT::ComponentType ComponentType
 A typedef to "export" the type of sub-components.
 
typedef Tvec4< DT > VectorType
 A typedef to "export" the type of component vector.
 

Public Member Functions

Tvec3< DT > transformPoint (const Tvec3< DT > &sourceVec) const
 Transforms the given sourceVec and returns the result vector.
 
bool operator< (const Tmat4< DT > &) const
 Dummy "lesser than operator" which always returns false.
 
template<class IDX_TYP >
DT determinantLower3 (const IDX_TYP col1, const IDX_TYP col2, const IDX_TYP col3) const
 
- Public Member Functions inherited from ml::FloatingPointMatrix< Tvec4< DT >, 4 >
const Tvec4< DT > & operator[] (const size_t i) const
 
Tvec4< DT > & operator[] (const size_t i)
 
ComponentTypelinearIndexed (const size_t idx)
 
ComponentType linearIndexedConst (const size_t idx) const
 
ComponentType compAbsSum () const
 
void setValuesFromPtr (const ComponentType *const values)
 Copies contents from array mat into *this, row by row; type and size must match.
 
void getValuesToPtr (ComponentType *values) const
 Copies contents of *this into array mat, row by row; type and size must match.
 

Constructors, set and get functionality of class Tmat4.

 Tmat4 ()
 Constructs a matrix from 16 zero elements.
 
 Tmat4 (const DT diagValue)
 
 Tmat4 (const Tvec4< DT > &row0, const Tvec4< DT > &row1, const Tvec4< DT > &row2, const Tvec4< DT > &row3)
 Composes a matrix from the four vectors row0, row1, row2 and row3.
 
 Tmat4 (const Tmat4< DT > &mat)
 Copy constructor from the Tmat4 mat.
 
 Tmat4 (const float mat[16])
 Constructor from 16 floating point values in an array given by mat, row by row.
 
 Tmat4 (const double mat[16])
 Constructor from 16 double values in an array given by mat, row by row.
 
Tmat4< DT > getRotationMatrix () const
 Returns the rotational part of the matrix (removes scaling and translation).
 
void set (const DT val)
 Sets all values to double val.
 
const Tmat4< DT > & operator= (const Tmat4< DT > &m)
 Assigns from a Tmat4.
 
const Tmat4< DT > & operator+= (const Tmat4< DT > &m)
 Increments by a Tmat4.
 
const Tmat4< DT > & operator-= (const Tmat4< DT > &m)
 Decrements by a Tmat4.
 
const Tmat4< DT > & operator*= (const DT d)
 Multiplies by an MLdouble constant d.
 
const Tmat4< DT > & operator/= (const DT d)
 Divides by an MLdouble constant d. Division by zero is not handled and must be avoided by caller.
 
const Tmat4< DT > & apply (MLDblFuncPtr fct)
 Applies the function fct to all vectors of *this and return the matrix.
 
static Tmat4< DT > getMat (const double val)
 Returns a matrix filled with values val.
 

Tmat4<DT> member functions

 Tmat4 (const double in00, const double in01, const double in02, const double in03, const double in10, const double in11, const double in12, const double in13, const double in20, const double in21, const double in22, const double in23, const double in30, const double in31, const double in32, const double in33)
 Initializes all matrix elements explicitly with scalars, row by row.
 
 Tmat4 (const Tvec3< DT > &n0, const Tvec3< DT > &n1, const Tvec3< DT > &n3, const Tvec3< DT > &t)
 Constructs a matrix from three base vectors and translation (as COLUMN vectors)
 
void setValues (const float mat[16])
 Copies the contents of mat into *this, row by row.
 
void getValues (float mat[16]) const
 Copies the contents of *this into floating point matrix mat, row by row.
 
void setValues (const double mat[16])
 Copies the contents of mat into *this, row by row.
 
void getValues (double mat[16]) const
 Copies the contents of *this into mat, row by row.
 
void setScaleMatrix (const DT scale)
 Sets a diagonal matrix with scale on diagonal.
 
DT det3 (DT A, DT B, DT C, DT D, DT E, DT F, DT G, DT H, DT I) const
 Determines the determinant of a 3x3 matrix given by A,B,C,D,E,F,G,H,I.
 
DT det () const
 Returns the determinant of *this.
 
Tmat4< DT > transpose () const
 Returns the transposed *this.
 
Tmat4< DT > inverse (bool *isInvertible=nullptr) const
 Returns the inverse Gauss-Jordan elimination with partial pivoting.
 
static Tmat4< DT > getIdentity ()
 Returns the identity matrix.
 

Additional Inherited Members

- Protected Attributes inherited from ml::FloatingPointMatrix< Tvec4< DT >, 4 >
Tvec4< DT > v [size]
 The rows constituting the matrix.
 

Detailed Description

template<class DT>
class ml::Tmat4< DT >

A four by four matrix class consisting of 4 row vectors.

Definition at line 35 of file mlMatrix4.h.

Member Typedef Documentation

◆ ComponentType

template<class DT >
typedef DT ml::Tmat4< DT >::ComponentType

A typedef to "export" the type of components.

Definition at line 40 of file mlMatrix4.h.

Constructor & Destructor Documentation

◆ Tmat4() [1/8]

template<class DT >
ml::Tmat4< DT >::Tmat4 ( )
inline

Constructs a matrix from 16 zero elements.

Definition at line 179 of file mlMatrix4.h.

◆ Tmat4() [2/8]

template<class DT >
ml::Tmat4< DT >::Tmat4 ( const DT diagValue)
inline

Definition at line 186 of file mlMatrix4.h.

◆ Tmat4() [3/8]

template<class DT >
ml::Tmat4< DT >::Tmat4 ( const Tvec4< DT > & row0,
const Tvec4< DT > & row1,
const Tvec4< DT > & row2,
const Tvec4< DT > & row3 )
inline

Composes a matrix from the four vectors row0, row1, row2 and row3.

Definition at line 195 of file mlMatrix4.h.

◆ Tmat4() [4/8]

template<class DT >
ml::Tmat4< DT >::Tmat4 ( const Tmat4< DT > & mat)
inline

Copy constructor from the Tmat4 mat.

Definition at line 205 of file mlMatrix4.h.

References ml::FloatingPointMatrix< VectorT, size >::v.

◆ Tmat4() [5/8]

template<class DT >
ml::Tmat4< DT >::Tmat4 ( const float mat[16])
inline

Constructor from 16 floating point values in an array given by mat, row by row.

Definition at line 215 of file mlMatrix4.h.

◆ Tmat4() [6/8]

template<class DT >
ml::Tmat4< DT >::Tmat4 ( const double mat[16])
inline

Constructor from 16 double values in an array given by mat, row by row.

Definition at line 222 of file mlMatrix4.h.

◆ Tmat4() [7/8]

template<class DT >
ml::Tmat4< DT >::Tmat4 ( const double in00,
const double in01,
const double in02,
const double in03,
const double in10,
const double in11,
const double in12,
const double in13,
const double in20,
const double in21,
const double in22,
const double in23,
const double in30,
const double in31,
const double in32,
const double in33 )

Initializes all matrix elements explicitly with scalars, row by row.

Definition at line 471 of file mlMatrix4.h.

◆ Tmat4() [8/8]

template<class DT >
ml::Tmat4< DT >::Tmat4 ( const Tvec3< DT > & n0,
const Tvec3< DT > & n1,
const Tvec3< DT > & n3,
const Tvec3< DT > & t )
inline

Constructs a matrix from three base vectors and translation (as COLUMN vectors)

Definition at line 443 of file mlMatrix4.h.

Member Function Documentation

◆ apply()

template<class DT >
const Tmat4< DT > & ml::Tmat4< DT >::apply ( MLDblFuncPtr fct)
inline

Applies the function fct to all vectors of *this and return the matrix.

Definition at line 329 of file mlMatrix4.h.

References ml::Tmat4< DT >::apply().

Referenced by ml::Tmat4< DT >::apply().

◆ det()

template<class DT >
DT ml::Tmat4< DT >::det ( ) const
inline

Returns the determinant of *this.

Definition at line 560 of file mlMatrix4.h.

Referenced by ml::Tmat5< DT >::determinantLower4().

◆ det3()

template<class DT >
DT ml::Tmat4< DT >::det3 ( DT A,
DT B,
DT C,
DT D,
DT E,
DT F,
DT G,
DT H,
DT I ) const
inline

Determines the determinant of a 3x3 matrix given by A,B,C,D,E,F,G,H,I.

Definition at line 550 of file mlMatrix4.h.

◆ determinantLower3()

template<class DT >
template<class IDX_TYP >
DT ml::Tmat4< DT >::determinantLower3 ( const IDX_TYP col1,
const IDX_TYP col2,
const IDX_TYP col3 ) const
inline

Definition at line 140 of file mlMatrix4.h.

◆ getIdentity()

template<class DT >
Tmat4< DT > ml::Tmat4< DT >::getIdentity ( )
inlinestatic

Returns the identity matrix.

Definition at line 584 of file mlMatrix4.h.

◆ getMat()

template<class DT >
Tmat4< DT > ml::Tmat4< DT >::getMat ( const double val)
inlinestatic

Returns a matrix filled with values val.

Definition at line 229 of file mlMatrix4.h.

◆ getRotationMatrix()

template<class DT >
Tmat4< DT > ml::Tmat4< DT >::getRotationMatrix ( ) const
inline

Returns the rotational part of the matrix (removes scaling and translation).

Definition at line 238 of file mlMatrix4.h.

References ml::FloatingPointVector< T, size, DataContainer >::normalize().

◆ getValues() [1/2]

template<class DT >
void ml::Tmat4< DT >::getValues ( double mat[16]) const

Copies the contents of *this into mat, row by row.

Note that range and precision of the float values may not be sufficient for long double matrix contents.

Definition at line 526 of file mlMatrix4.h.

◆ getValues() [2/2]

template<class DT >
void ml::Tmat4< DT >::getValues ( float mat[16]) const

Copies the contents of *this into floating point matrix mat, row by row.

Note that range and precision of the float values may not be sufficient for double or long double matrix contents.

Definition at line 500 of file mlMatrix4.h.

◆ inverse()

template<class DT >
Tmat4< DT > ml::Tmat4< DT >::inverse ( bool * isInvertible = nullptr) const

Returns the inverse Gauss-Jordan elimination with partial pivoting.

If a non-NULL Boolean pointer is passed to isInvertible then true is returned in *isInvertible in the case of a successful inversion or false if the inversion is not possible (function return is the identity then). If a NULL pointer is passed as isInvertible the matrix must be invertible, otherwise errors will occur.

Definition at line 686 of file mlMatrix4.h.

References ml::MLInverseMatHelper().

◆ operator*=()

template<class DT >
const Tmat4< DT > & ml::Tmat4< DT >::operator*= ( const DT d)
inline

Multiplies by an MLdouble constant d.

Definition at line 307 of file mlMatrix4.h.

◆ operator+=()

template<class DT >
const Tmat4< DT > & ml::Tmat4< DT >::operator+= ( const Tmat4< DT > & m)
inline

Increments by a Tmat4.

Definition at line 285 of file mlMatrix4.h.

References ml::FloatingPointMatrix< VectorT, size >::v.

◆ operator-=()

template<class DT >
const Tmat4< DT > & ml::Tmat4< DT >::operator-= ( const Tmat4< DT > & m)
inline

Decrements by a Tmat4.

Definition at line 296 of file mlMatrix4.h.

References ml::FloatingPointMatrix< VectorT, size >::v.

◆ operator/=()

template<class DT >
const Tmat4< DT > & ml::Tmat4< DT >::operator/= ( const DT d)
inline

Divides by an MLdouble constant d. Division by zero is not handled and must be avoided by caller.

Definition at line 318 of file mlMatrix4.h.

◆ operator<()

template<class DT >
bool ml::Tmat4< DT >::operator< ( const Tmat4< DT > & ) const
inline

Dummy "lesser than operator" which always returns false.

It is needed to make class work with some STL containers on VC7.

Definition at line 113 of file mlMatrix4.h.

◆ operator=()

template<class DT >
const Tmat4< DT > & ml::Tmat4< DT >::operator= ( const Tmat4< DT > & m)
inline

Assigns from a Tmat4.

Definition at line 272 of file mlMatrix4.h.

References ml::FloatingPointMatrix< VectorT, size >::v.

◆ set()

template<class DT >
void ml::Tmat4< DT >::set ( const DT val)
inline

Sets all values to double val.

Definition at line 265 of file mlMatrix4.h.

Referenced by ml::TQuaternion< DT >::getAsMat4().

◆ setScaleMatrix()

template<class DT >
void ml::Tmat4< DT >::setScaleMatrix ( const DT scale)

Sets a diagonal matrix with scale on diagonal.

Definition at line 538 of file mlMatrix4.h.

◆ setValues() [1/2]

template<class DT >
void ml::Tmat4< DT >::setValues ( const double mat[16])

Copies the contents of mat into *this, row by row.

Definition at line 512 of file mlMatrix4.h.

◆ setValues() [2/2]

template<class DT >
void ml::Tmat4< DT >::setValues ( const float mat[16])

Copies the contents of mat into *this, row by row.

Definition at line 486 of file mlMatrix4.h.

◆ transformPoint()

template<class DT >
Tvec3< DT > ml::Tmat4< DT >::transformPoint ( const Tvec3< DT > & sourceVec) const
inline

Transforms the given sourceVec and returns the result vector.

Definition at line 94 of file mlMatrix4.h.

References ml::Tvec3< DT >::affinePoint().

◆ transpose()

template<class DT >
Tmat4< DT > ml::Tmat4< DT >::transpose ( ) const
inline

Returns the transposed *this.

Definition at line 572 of file mlMatrix4.h.

Referenced by ml::operator*(), and ml::operator*().


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