MeVisLab Toolbox Reference
ml::Tmat4< DT > Class Template Reference

A 4x4 matrix class consisting of four 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., it can be used as a template argument. More...
 
enum  
 This enum grants access to the row count during compile time, e.g., it can be used as a template argument. More...
 
enum  
 This enum grants access to the number of values in the matrix, e.g., it can be used as a template argument. More...
 
typedef VectorT::ComponentType ComponentType
 A typedef to 'export' the type of subcomponents. 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' that always returns false. More...
 
template<class IDX_TYP >
DT determinantLower3 (const IDX_TYP col1, const IDX_TYP col2, const IDX_TYP col3) const
 Determines the (sub)determinant of columns given by col1, col2, and col3. More...
 
- 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 the contents from an array matrix into *this, row by row; type and size must match. More...
 
void getValuesToPtr (ComponentType *values) const
 Copies contents of *this into an array matrix, 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)
 Builds a matrix that has the argument diagValue as the diagonal values, zero otherwise. More...
 
 Tmat4 (const Tvec4< DT > &row0, const Tvec4< DT > &row1, const Tvec4< DT > &row2, const Tvec4< DT > &row3)
 Composes a matrix from the four row 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 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 a constant d. More...
 
const Tmat4< DT > & operator/= (const DT d)
 Divides by a 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 each component. 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, filling it 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 n0, ... More...
 
void setValues (const float mat[16])
 Copies the contents from float array 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 from double array mat into *this, row by row. More...
 
void getValues (double mat[16]) const
 Copies the contents of *this into into double matrix mat, row by row. More...
 
void setScaleMatrix (const DT scale)
 Sets a diagonal matrix with [ scale on the 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. 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 4x4 matrix class consisting of four 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

Builds a matrix that has the argument diagValue as the diagonal values, zero otherwise.

Constructs a matrix that has the argument diagValue as the diagonal values, zero otherwise.

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 row vectors row0, row1, row2, and row3.

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, filling it row by row.

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

Definition at line 471 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 n0, ...

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

n3 and a translation t, all given 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 each component.

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

Definition at line 329 of file mlMatrix4.h.

◆ det()

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

Returns the determinant of this.

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.

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

Determines the (sub)determinant of columns given by col1, col2, and col3.

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
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 into double matrix mat, row by row.

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

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

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.

Returns the inverse Gauss-Jordan elimination with partial pivoting.

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 returns the identity then). If a NULL pointer is passed as isInvertible, the matrix must be invertible; otherwise, errors will occur.

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 685 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 a constant d.

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 a constant d. Division by zero is not handled and must be avoided by caller.

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' that 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 val.

Sets all values to double val.

Definition at line 265 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 the diagonal.

Sets a diagonal matrix with scale on the 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 from double array mat into *this, row by row.

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

Definition at line 512 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 from float array mat into *this, row by row.

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
inline

Returns the transposed *this.

Definition at line 572 of file mlMatrix4.h.

Referenced by ml::operator*().


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