MeVisLab Toolbox 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. More...
 
- 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. More...
 
typedef Tvec4< DT > VectorType
 A typedef to "export" the type of component vector. More...
 

Public Member Functions

Tvec3< DT > transformPoint (const Tvec3< DT > &sourceVec) const
 Transforms the given sourceVec and returns the result vector. More...
 
bool operator< (const Tmat4< DT > &) const
 Dummy "lesser than operator" which always returns false. More...
 
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. More...
 
void getValuesToPtr (ComponentType *values) const
 Copies contents of *this into array mat, row by row; type and size must match. More...
 

Constructors, set and get functionality of class Tmat4.

 Tmat4 ()
 Constructs a matrix from 16 zero elements. More...
 
 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. More...
 
 Tmat4 (const Tmat4< DT > &mat)
 Copy constructor from the Tmat4 mat. More...
 
 Tmat4 (const float mat[16])
 Constructor from 16 floating point values in an array given by mat, row by row. More...
 
 Tmat4 (const double mat[16])
 Constructor from 16 double values in an array given by mat, row by row. More...
 
Tmat4< DT > getRotationMatrix () const
 Returns the rotational part of the matrix (removes scaling and translation). More...
 
void set (const DT val)
 Sets all values to double val. More...
 
const Tmat4< DT > & operator= (const Tmat4< DT > &m)
 Assigns from a Tmat4. More...
 
const Tmat4< DT > & operator+= (const Tmat4< DT > &m)
 Increments by a Tmat4. More...
 
const Tmat4< DT > & operator-= (const Tmat4< DT > &m)
 Decrements by a Tmat4. More...
 
const Tmat4< DT > & operator*= (const DT d)
 Multiplies by an MLdouble constant d. More...
 
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. More...
 
const Tmat4< DT > & apply (MLDblFuncPtr fct)
 Applies the function fct to all vectors of *this and return the matrix. More...
 
static Tmat4< DT > getMat (const double val)
 Returns a matrix filled with values val. More...
 

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. More...
 
 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) More...
 
void setValues (const float mat[16])
 Copies the contents of mat into *this, row by row. More...
 
void getValues (float mat[16]) const
 Copies the contents of *this into floating point matrix mat, row by row. More...
 
void setValues (const double mat[16])
 Copies the contents of mat into *this, row by row. More...
 
void getValues (double mat[16]) const
 Copies the contents of *this into mat, row by row. More...
 
void setScaleMatrix (const DT scale)
 Sets a diagonal matrix with scale on diagonal. More...
 
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. More...
 
DT det () const
 Returns the determinant of *this. More...
 
Tmat4< DT > transpose () const
 Returns the transposed *this. More...
 
Tmat4< DT > inverse (bool *isInvertible=nullptr) const
 Returns the inverse Gauss-Jordan elimination with partial pivoting. More...
 
static Tmat4< DT > getIdentity ()
 Returns the identity matrix. More...
 

Additional Inherited Members

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

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 191 of file mlMatrix4.h.

◆ Tmat4() [2/8]

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

Definition at line 198 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 207 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 217 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 227 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 234 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 483 of file mlMatrix4.h.

References DCMTree::DT.

◆ 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 455 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 341 of file mlMatrix4.h.

◆ det()

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

Returns the determinant of *this.

Definition at line 572 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 562 of file mlMatrix4.h.

References A, B, C, D, E, F, G, H, and I.

◆ 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 152 of file mlMatrix4.h.

◆ getIdentity()

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

Returns the identity matrix.

Definition at line 596 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 241 of file mlMatrix4.h.

◆ getRotationMatrix()

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

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

Definition at line 250 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 538 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 512 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 698 of file mlMatrix4.h.

References DCMTree::DT, and 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 319 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 297 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 308 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 330 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 125 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 284 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 277 of file mlMatrix4.h.

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

◆ setScaleMatrix()

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

Sets a diagonal matrix with scale on diagonal.

Definition at line 550 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 524 of file mlMatrix4.h.

References DCMTree::DT.

◆ 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 498 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
inline

Returns the transposed *this.

Definition at line 584 of file mlMatrix4.h.

Referenced by ml::operator*().


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