Loading...
Searching...
No Matches
BALL::TMatrix4x4< T > Class Template Reference

Default Type. More...

`#include <BALL/MATHS/matrix44.h>`

## Public Member Functions

Constructors and Destructors
| TMatrix4x4 ()
| TMatrix4x4 (const T *ptr)
| TMatrix4x4 (const T ptr[4][4])
| TMatrix4x4 (const TMatrix4x4 &m)
| TMatrix4x4 (const TVector4< T > &col1, const TVector4< T > &col2, const TVector4< T > &col3, const TVector4< T > &col4)
| TMatrix4x4 (const T &m11, const T &m12, const T &m13, const T &m14, const T &m21, const T &m22, const T &m23, const T &m24, const T &m31, const T &m32, const T &m33, const T &m34, const T &m41, const T &m42, const T &m43, const T &m44)
virtual | ~TMatrix4x4 ()
virtual void | clear ()
Assignment
void | set (const T *ptr)
void | set (const T ptr[4][4])
void | set (const TMatrix4x4 &m)
void | set (const TVector4< T > &col1, const TVector4< T > &col2, const TVector4< T > &col3, const TVector4< T > &col4)
void | set (const T &m11, const T &m12, const T &m13, const T &m14, const T &m21, const T &m22, const T &m23, const T &m24, const T &m31, const T &m32, const T &m33, const T &m34, const T &m41, const T &m42, const T &m43, const T &m44)
TMatrix4x4 & | operator= (const T *ptr)
TMatrix4x4 & | operator= (const T ptr[4][4])
TMatrix4x4 & | operator= (const TMatrix4x4 &m)
void | get (T *ptr) const
void | get (T ptr[4][4]) const
void | get (TMatrix4x4 &m) const
void | get (TVector4< T > &col1, TVector4< T > &col2, TVector4< T > &col3, TVector4< T > &col4) const
void | get (T &m11, T &m12, T &m13, T &m14, T &m21, T &m22, T &m23, T &m24, T &m31, T &m32, T &m33, T &m34, T &m41, T &m42, T &m43, T &m44) const
void | swap (TMatrix4x4 &m)
Predicates
bool | operator== (const TMatrix4x4 &m) const
bool | operator!= (const TMatrix4x4 &m) const
bool | isIdentity () const
bool | isRegular () const
bool | isSingular () const
bool | isSymmetric () const
bool | isLowerTriangular () const
bool | isUpperTriangular () const
bool | isDiagonal () const
Debugging and Diagnostics
bool | isValid () const
void | dump (std::ostream &s=std::cout, Size depth=0) const

## Attributes

T | m11
| 1st cell in the 1st row
T | m12
| 2nd cell in the 1st row
T | m13
| 3rd cell in the 1st row
T | m14
| 4th cell in the 1st row
T | m21
| 1st cell in the 2nd row
T | m22
| 2nd cell in the 2nd row
T | m23
| 3rd cell in the 2nd row
T | m24
| 4th cell in the 2nd row
T | m31
| 1st cell in the 3rd row
T | m32
| 2nd cell in the 3rd row
T | m33
| 3rd cell in the 3rd row
T | m34
| 4th cell in the 3rd row
T | m41
| 1st cell in the 4th row
T | m42
| 2nd cell in the 4th row
T | m43
| 3rd cell in the 4th row
T | m44
| 4th cell in the 4th row

## Accessors

T | getTrace () const
void | setIdentity ()
void | set (const T &t=(T) 1)
void | transpose ()
TVector4< T > | getRow (Position row) const
TVector4< T > | getColumn (Position col) const
void | setRow (Position row, const TVector4< T > &row_value)
void | setColumn (Position col, const TVector4< T > &col_value)
bool | isEqual (const TMatrix4x4 &m) const
TVector4< T > | getDiagonal () const
T & | operator() (Position row, Position col)
const T & | operator() (Position row, Position col) const
const T & | operator[] (Position position) const
T & | operator[] (Position position)
TMatrix4x4 | operator+ () const
TMatrix4x4 | operator- () const
TMatrix4x4 | operator+ (const TMatrix4x4 &m) const
TMatrix4x4 & | operator+= (const TMatrix4x4 &m)
TMatrix4x4 | operator- (const TMatrix4x4 &m) const
TMatrix4x4 & | operator-= (const TMatrix4x4 &m)
TMatrix4x4 | operator* (const T &scalar) const
TMatrix4x4 & | operator*= (const T &scalar)
TMatrix4x4 | operator/ (const T &scalar) const
TMatrix4x4 & | operator/= (const T &scalar)
TMatrix4x4 | operator* (const TMatrix4x4 &m) const
TMatrix4x4 & | operator*= (const TMatrix4x4 &m)
TVector4< T > | operator* (const TVector4< T > &vector) const
bool | invert (TMatrix4x4 &inverse) const
bool | invert ()
T | getDeterminant () const
void | translate (const T &x, const T &y, const T &z)
void | translate (const TVector3< T > &v)
void | setTranslation (const T &x, const T &y, const T &z)
void | setTranslation (const TVector3< T > &v)
void | scale (const T &x_scale, const T &y_scale, const T &z_scale)
void | scale (const T &scale)
void | scale (const TVector3< T > &v)
void | setScale (const T &x_scale, const T &y_scale, const T &z_scale)
void | setScale (const T &scale)
void | setScale (const TVector3< T > &v)
void | rotateX (const TAngle< T > &phi)
void | setRotationX (const TAngle< T > &phi)
void | rotateY (const TAngle< T > &phi)
void | setRotationY (const TAngle< T > &phi)
void | rotateZ (const TAngle< T > &phi)
void | setRotationZ (const TAngle< T > &phi)
void | rotate (const TAngle< T > &phi, const T &axis_x, const T &axis_y, const T &axis_z)
void | rotate (const TAngle< T > &phi, const TVector3< T > &axis)
void | rotate (const TAngle< T > &phi, const TVector4< T > &axis)
void | setRotation (const TAngle< T > &phi, const T &axis_x, const T &axis_y, const T &axis_z)
void | setRotation (const TAngle< T > &phi, const TVector3< T > &axis)
void | setRotation (const TAngle< T > &phi, const TVector4< T > &axis)
static const TMatrix4x4 & | getZero ()
static const TMatrix4x4 & | getIdentity ()

## Detailed Description

template<typename T>
class BALL::TMatrix4x4< T >

Default Type.

Generic 4x4 Matrix Class.

Definition at line 67 of file matrix44.h.

## Constructor & Destructor Documentation

## TMatrix4x4() [1/6]

template<typename T>

BALL::TMatrix4x4< T >::TMatrix4x4 | ( |  | ) |

Default constructor. This method creates a new TMatrix4x4 object. The components are initialized to 0.

Definition at line 738 of file matrix44.h.

## TMatrix4x4() [2/6]

template<typename T>

BALL::TMatrix4x4< T >::TMatrix4x4 | ( | const T * | ptr | ) |

Array constructor. This constructor creates a TMatrix4x4 object from the first sixteen elements pointed to by ptr.

Parameters

  ptr | the array to construct from

Exceptions

  NullPointer | if ptr == 0

Definition at line 748 of file matrix44.h.

## TMatrix4x4() [3/6]

template<typename T>

BALL::TMatrix4x4< T >::TMatrix4x4 | ( | const T | ptr[4][4] | ) |

Array constructor. This constructor creates a TMatrix4x4 object from the sixteen elements in the array assigned by ptr.

Parameters

  ptr | the array to construct from

Exceptions

  NullPointer | if ptr == 0

Definition at line 764 of file matrix44.h.

## TMatrix4x4() [4/6]

template<typename T>

BALL::TMatrix4x4< T >::TMatrix4x4 | ( | const TMatrix4x4< T > & | m | ) |

Copy constructor. Create a new TMatrix4x4 object from another.

Parameters

  TMatrix4x4 | the TMatrix4x4 object to be copied
  bool | ignored (just for interface consistency)

Definition at line 782 of file matrix44.h.

## TMatrix4x4() [5/6]

template<typename T>

BALL::TMatrix4x4< T >::TMatrix4x4 | ( | const TVector4< T > & | col1,
|  | const TVector4< T > & | col2,
|  | const TVector4< T > & | col3,
|  | const TVector4< T > & | col4 )

Detailed constructor. Create a new TMatrix4x4 object from four TVector4.

Parameters

  col1 | assigned to the first column
  col2 | assigned to the second column
  col3 | assigned to the third column
  col4 | assigned to the fourth column

Definition at line 793 of file matrix44.h.

## TMatrix4x4() [6/6]

template<typename T>

BALL::TMatrix4x4< T >::TMatrix4x4 | ( | const T & | m11,
|  | const T & | m12,
|  | const T & | m13,
|  | const T & | m14,
|  | const T & | m21,
|  | const T & | m22,
|  | const T & | m23,
|  | const T & | m24,
|  | const T & | m31,
|  | const T & | m32,
|  | const T & | m33,
|  | const T & | m34,
|  | const T & | m41,
|  | const T & | m42,
|  | const T & | m43,
|  | const T & | m44 )

Detailed constructor. Create a new TMatrix4x4 object from sixteen T values.

Parameters

  m11 | - m44 assigned to the components

Definition at line 805 of file matrix44.h.

## ~TMatrix4x4()

template<typename T>

virtual BALL::TMatrix4x4< T >::~TMatrix4x4 | ( |  | ) |

inline virtual

Destructor. Destructs the TMatrix4x4 object. As there are no dynamic data structures, nothing happens.

Definition at line 136 of file matrix44.h.

## Member Function Documentation

## clear()

template<typename T>

void BALL::TMatrix4x4< T >::clear | ( |  | ) |

virtual

Clear method. The values are set to 0.

Definition at line 819 of file matrix44.h.

## dump()

template<typename T>

void BALL::TMatrix4x4< T >::dump | ( | std::ostream & | s = std::cout,
|  | Size | depth = 0 ) const

Internal state dump. Dump the current internal state of {*this} to the output ostream s with dumping depth depth .

Parameters

  s | - output stream where to output the internal state of {*this}
  depth | - the dumping depth

Definition at line 2151 of file matrix44.h.

## get() [1/5]

template<typename T>

void BALL::TMatrix4x4< T >::get | ( | T & | m11,
|  | T & | m12,
|  | T & | m13,
|  | T & | m14,
|  | T & | m21,
|  | T & | m22,
|  | T & | m23,
|  | T & | m24,
|  | T & | m31,
|  | T & | m32,
|  | T & | m33,
|  | T & | m34,
|  | T & | m41,
|  | T & | m42,
|  | T & | m43,
|  | T & | m44 ) const

Assign to sixteen variables of type T.

Parameters

  m11 | - m44 the variables to assign to

Definition at line 959 of file matrix44.h.

## get() [2/5]

template<typename T>

void BALL::TMatrix4x4< T >::get | ( | T * | ptr | ) | const

Assign to an array. Assigns the components to a pointer of an array of sixteen values of type T.

Parameters

  ptr | the pointer to assign to

Exceptions

  NullPointer | if ptr == 0

Definition at line 912 of file matrix44.h.

## get() [3/5]

template<typename T>

void BALL::TMatrix4x4< T >::get | ( | T | ptr[4][4] | ) | const

Assign to an array. Assigns the components to an array of sixteen values of type T.

Parameters

  ptr | the array to assign to

Exceptions

  NullPointer | if ptr == 0

Definition at line 926 of file matrix44.h.

## get() [4/5]

template<typename T>

void BALL::TMatrix4x4< T >::get | ( | TMatrix4x4< T > & | m | ) | const

Assign to another instance. Assigns the components to another TMatrix4x4.

Parameters

  TMatrix4x4 | the TMatrix4x4 to be assigned to

Definition at line 942 of file matrix44.h.

## get() [5/5]

template<typename T>

void BALL::TMatrix4x4< T >::get | ( | TVector4< T > & | col1,
|  | TVector4< T > & | col2,
|  | TVector4< T > & | col3,
|  | TVector4< T > & | col4 ) const

Assign to four variables of type TVector4 .

Parameters

  col1 | the TVector4 to obtain the values of the first column
  col2 | the TVector4 to obtain the values of the second column
  col3 | the TVector4 to obtain the values of the third column
  col4 | the TVector4 to obtain the values of the fourth column

Definition at line 948 of file matrix44.h.

## getColumn()

template<typename T>

TVector4< T > BALL::TMatrix4x4< T >::getColumn | ( | Position | col | ) | const

Get a column of the matrix.

Parameters

  col | the number of the column (0-3)

Returns
  TVector4 the column

Exceptions

  IndexOverflow | if col > 3

Definition at line 1085 of file matrix44.h.

## getDeterminant()

template<typename T>

T BALL::TMatrix4x4< T >::getDeterminant | ( |  | ) | const

Compute the determinant.

Returns
  T the determinant.

Definition at line 1559 of file matrix44.h.

## getDiagonal()

template<typename T>

TVector4< T > BALL::TMatrix4x4< T >::getDiagonal | ( |  | ) | const

Get the diagonal of the matrix.

Returns
  TVector4 the diagonal

Definition at line 1149 of file matrix44.h.

## getIdentity()

template<typename T>

BALL_INLINE const TMatrix4x4< T > & BALL::TMatrix4x4< T >::getIdentity | ( |  | ) |

static

Create an identity matrix. A new matrix object is created and all elements but the diagonal are set to zero. The diagonal elements are set to 1.

Definition at line 1001 of file matrix44.h.

## getRow()

template<typename T>

TVector4< T > BALL::TMatrix4x4< T >::getRow | ( | Position | row | ) | const

Get a row of the matrix.

Parameters

  row | the number of the row (0-3)

Returns
  TVector4 the row

Exceptions

  IndexOverflow | if row > 3

Definition at line 1072 of file matrix44.h.

## getTrace()

template<typename T>

BALL_INLINE T BALL::TMatrix4x4< T >::getTrace | ( |  | ) | const

Compute the trace. Get the sum of the diagonal elements (m11 + m22 + m33 + m44).

Returns
  T the trace

Definition at line 973 of file matrix44.h.

## getZero()

template<typename T>

BALL_INLINE const TMatrix4x4< T > & BALL::TMatrix4x4< T >::getZero | ( |  | ) |

static

Create a zero matrix. A new matrix object is created and all elements set to 0.

Definition at line 980 of file matrix44.h.

## invert() [1/2]

template<typename T>

BALL_INLINE bool BALL::TMatrix4x4< T >::invert | ( |  | ) |

Invert the matrix. Tests if the matrix can be inverted. If this is possible, the result is stored in the matrix.

Returns
  bool true if the inverse matrix could be calculated, otherwise false.

Definition at line 1553 of file matrix44.h.

## invert() [2/2]

template<typename T>

bool BALL::TMatrix4x4< T >::invert | ( | TMatrix4x4< T > & | inverse | ) | const

Invert the matrix. Tests if the matrix can be inverted. If possible, the result will be inverted and the result returned in inverse .

Parameters

  inverse | is assigned the inverse matrix

Returns
  bool true if the inverse matrix could be calculated, otherwise false.

First, we compute a QR decomposition, then we use it to solve the system A*A^-1 = I <=> R * A^-1 = Q^t, where R is upper triangular.

This is based on the Householder transform algorithm given in the Numerical Recipes.

Definition at line 1422 of file matrix44.h.

## isDiagonal()

template<typename T>

BALL_INLINE bool BALL::TMatrix4x4< T >::isDiagonal | ( |  | ) | const

Test whether all cells but the diagonal are zero.

Returns
  bool, true or false

Definition at line 2087 of file matrix44.h.

## isEqual()

template<typename T>

bool BALL::TMatrix4x4< T >::isEqual | ( | const TMatrix4x4< T > & | m | ) | const

Test whether two matrices are equal. Two matrices are considered equal, if Maths::isEqual returns true for each pair of corresponding elements.

Parameters

  m | the matrix to compare with

Returns
  bool, true if all components are equal, false otherwise

Definition at line 1133 of file matrix44.h.

## isIdentity()

template<typename T>

bool BALL::TMatrix4x4< T >::isIdentity | ( |  | ) | const

Test whether this matrix is an identity matrix. (I.e. m11, m22, m33, m44 = 1 and the other cells have the value 0)

Returns
  bool, true if identity matrix, false otherwise

Definition at line 2020 of file matrix44.h.

## isLowerTriangular()

template<typename T>

bool BALL::TMatrix4x4< T >::isLowerTriangular | ( |  | ) | const

Test whether the lower triangular is zero.

Returns
  bool, true if (m12 = m13 = m14 = m23 = m24 = m34 = 0), false otherwise

Definition at line 2064 of file matrix44.h.

## isRegular()

template<typename T>

BALL_INLINE bool BALL::TMatrix4x4< T >::isRegular | ( |  | ) | const

Test whether this matrix is regular.

Returns
  bool, true if (Determinant != 0), false otherwise

Definition at line 2043 of file matrix44.h.

## isSingular()

template<typename T>

BALL_INLINE bool BALL::TMatrix4x4< T >::isSingular | ( |  | ) | const

Test whether this matrix is singular.

Returns
  bool, true if (Determinant == 0), false otherwise

Definition at line 2050 of file matrix44.h.

## isSymmetric()

template<typename T>

bool BALL::TMatrix4x4< T >::isSymmetric | ( |  | ) | const

Test whether this matrix is symmetric. (m12 = m21, m31 = m13, ...)

Returns
  bool, true if symmatric, false otherwise

Definition at line 2056 of file matrix44.h.

## isUpperTriangular()

template<typename T>

bool BALL::TMatrix4x4< T >::isUpperTriangular | ( |  | ) | const

Test whether the upper triangular is zero.

Returns
  bool, true if (m21 = m31 = m32 = m41 = m42 = m43 = 0), false otherwise

Definition at line 2075 of file matrix44.h.

## isValid()

template<typename T>

bool BALL::TMatrix4x4< T >::isValid | ( |  | ) | const

Test whether instance is valid. Always returns true.

Returns
  bool true

Definition at line 2104 of file matrix44.h.

## operator!=()

template<typename T>

bool BALL::TMatrix4x4< T >::operator!= | ( | const TMatrix4x4< T > & | m | ) | const

Inequality operator. Instead of this operator isEqual should be used. isEqual

Returns
  bool, true if the two TMatrix4x4 differ in at least one component, false otherwise

Definition at line 1998 of file matrix44.h.

## operator()() [1/2]

template<typename T>

BALL_INLINE T & BALL::TMatrix4x4< T >::operator() | ( | Position | row,
|  | Position | col )

Access operator of a cell.

Parameters

  row | the number of the row (0-3)
  col | the number of the column (0-3)

Returns
  T& a reference to the cell

Exceptions

  IndexOverflow | if col >3 || row > 3

Definition at line 1156 of file matrix44.h.

## operator()() [2/2]

template<typename T>

BALL_INLINE const T & BALL::TMatrix4x4< T >::operator() | ( | Position | row,
|  | Position | col ) const

Constant access operator of a cell.

Parameters

  row | the number of the row (0-3)
  col | the number of the column (0-3)

Returns
  T& a const reference to the cell

Exceptions

  IndexOverflow | if col ||row > 3

Definition at line 1168 of file matrix44.h.

## operator*() [1/3]

template<typename T>

TMatrix4x4< T > BALL::TMatrix4x4< T >::operator* | ( | const T & | scalar | ) | const

Multiply by a scalar. Operator for multiplying every cell value with a scalar value.

Returns
  TMatrix4x4 the result

Definition at line 1285 of file matrix44.h.

## operator*() [2/3]

template<typename T>

TMatrix4x4< T > BALL::TMatrix4x4< T >::operator* | ( | const TMatrix4x4< T > & | m | ) | const

Multiply two matrices.

Returns
  TMatrix4x4 the result

Definition at line 1361 of file matrix44.h.

## operator*() [3/3]

template<typename T>

TVector4< T > BALL::TMatrix4x4< T >::operator* | ( | const TVector4< T > & | vector | ) | const

Multiplication by an instance of type TVector4 .

Returns
  TMatrix4x4&, {*this}

Definition at line 1412 of file matrix44.h.

## operator*=() [1/2]

template<typename T>

TMatrix4x4< T > & BALL::TMatrix4x4< T >::operator*= | ( | const T & | scalar | ) |

Multiply by a scalar. Operator for multiplying every cell value with a scalar value.

Returns
  TMatrix4x4&, {*this}

Definition at line 1305 of file matrix44.h.

## operator*=() [2/2]

template<typename T>

TMatrix4x4< T > & BALL::TMatrix4x4< T >::operator*= | ( | const TMatrix4x4< T > & | m | ) |

Multiply two matrices

Returns
  TMatrix4x4&, {*this}

Definition at line 1386 of file matrix44.h.

## operator+() [1/2]

template<typename T>

BALL_INLINE TMatrix4x4< T > BALL::TMatrix4x4< T >::operator+ | ( |  | ) | const

Positive sign.

Definition at line 1202 of file matrix44.h.

## operator+() [2/2]

template<typename T>

TMatrix4x4< T > BALL::TMatrix4x4< T >::operator+ | ( | const TMatrix4x4< T > & | m | ) | const

Addition operator. Adds another matrix to this matrix and return the result.

Parameters

  m | the matrix to add

Returns
  TMatrix4x4 the result

Definition at line 1219 of file matrix44.h.

## operator+=()

template<typename T>

TMatrix4x4< T > & BALL::TMatrix4x4< T >::operator+= | ( | const TMatrix4x4< T > & | m | ) |

Addition operator. Adds another matrix to this matrix.

Parameters

  m | the matrix to add

Returns
  TMatrix4x4&, {*this}

Definition at line 1229 of file matrix44.h.

## operator-() [1/2]

template<typename T>

BALL_INLINE TMatrix4x4< T > BALL::TMatrix4x4< T >::operator- | ( |  | ) | const

Negative sign.

Definition at line 1209 of file matrix44.h.

## operator-() [2/2]

template<typename T>

TMatrix4x4< T > BALL::TMatrix4x4< T >::operator- | ( | const TMatrix4x4< T > & | m | ) | const

Subtraction operator. Subtract another matrix from this matrix and return the result

Parameters

  m | the matrix to subtract

Returns
  TMatrix4x4 the result

Definition at line 1252 of file matrix44.h.

## operator-=()

template<typename T>

TMatrix4x4< T > & BALL::TMatrix4x4< T >::operator-= | ( | const TMatrix4x4< T > & | m | ) |

Subtraction operator. Subtract another matrix from this matrix.

Parameters

  m | the matrix to subtract

Returns
  TMatrix4x4&, {*this}

Definition at line 1262 of file matrix44.h.

## operator/()

template<typename T>

BALL_INLINE TMatrix4x4< T > BALL::TMatrix4x4< T >::operator/ | ( | const T & | scalar | ) | const

Divide by a scalar. Operator for dividing every cell value by a scalar value.

Returns
  TMatrix4x4 the result

Exceptions

  DivisionByZero | if scalar == 0

Definition at line 1338 of file matrix44.h.

## operator/=()

template<typename T>

BALL_INLINE TMatrix4x4< T > & BALL::TMatrix4x4< T >::operator/= | ( | const T & | scalar | ) |

Divide by a scalar. Operator for dividing every cell value by a scalar value.

Returns
  TMatrix4x4&, {*this}

Exceptions

  DivisionByZero | if scalar == 0

Definition at line 1350 of file matrix44.h.

## operator=() [1/3]

template<typename T>

BALL_INLINE TMatrix4x4< T > & BALL::TMatrix4x4< T >::operator= | ( | const T * | ptr | ) |

Assignment operator. Assign the components from the first 16 values assigned by ptr.

Parameters

  ptr | the array to construct from

Exceptions

  NullPointer | if ptr == 0

Definition at line 889 of file matrix44.h.

## operator=() [2/3]

template<typename T>

BALL_INLINE TMatrix4x4< T > & BALL::TMatrix4x4< T >::operator= | ( | const T | ptr[4][4] | ) |

Assignment operator. Assign the components from the first 16 values assigned by ptr.

Parameters

  ptr | the array to construct from

Exceptions

  NullPointer | if ptr == 0

Definition at line 897 of file matrix44.h.

## operator=() [3/3]

template<typename T>

BALL_INLINE TMatrix4x4< T > & BALL::TMatrix4x4< T >::operator= | ( | const TMatrix4x4< T > & | m | ) |

Assignment operator. Assign the components from another instance of TMatrix4x4.

Parameters

  TMatrix4x4 | the TMatrix4x4 to assign from

Definition at line 905 of file matrix44.h.

## operator==()

template<typename T>

bool BALL::TMatrix4x4< T >::operator== | ( | const TMatrix4x4< T > & | m | ) | const

Equality operator. Instead of this operator isEqual should be used. isEqual

Returns
  bool, true if all components are equal, false otherwise

Definition at line 1976 of file matrix44.h.

## operator[]() [1/2]

template<typename T>

BALL_INLINE T & BALL::TMatrix4x4< T >::operator[] | ( | Position | position | ) |

Mutable random access operator.

See also
  operator[]

Exceptions

  IndexOverflow | if position > 15

Definition at line 1191 of file matrix44.h.

## operator[]() [2/2]

template<typename T>

BALL_INLINE const T & BALL::TMatrix4x4< T >::operator[] | ( | Position | position | ) | const

Constant random access operator. Access single elements of the matrix. index may assume values in the range of 0 - 15. The elements of the matrix are returned rows first, i.e., in the following order: m11, m12, m13...

Exceptions

  IndexOverflow | if position > 15

Definition at line 1180 of file matrix44.h.

## rotate() [1/3]

template<typename T>

void BALL::TMatrix4x4< T >::rotate | ( | const TAngle< T > & | phi,
|  | const T & | axis_x,
|  | const T & | axis_y,
|  | const T & | axis_z )

Rotate the matrix around a given axis.

Parameters

  phi | the rotation angle
  axis_x | the x component of the axis
  axis_y | the y component of the axis
  axis_z | the z component of the axis

Definition at line 1887 of file matrix44.h.

## rotate() [2/3]

template<typename T>

BALL_INLINE void BALL::TMatrix4x4< T >::rotate | ( | const TAngle< T > & | phi,
|  | const TVector3< T > & | axis )

Rotate the matrix around a given axis.

Parameters

  phi | the rotation angle
  axis | the axis vector

Definition at line 1818 of file matrix44.h.

## rotate() [3/3]

template<typename T>

BALL_INLINE void BALL::TMatrix4x4< T >::rotate | ( | const TAngle< T > & | phi,
|  | const TVector4< T > & | axis )

Rotate the matrix around a given axis.

Parameters

  phi | the rotation angle
  axis | the axis vector, the fourth component of the vector is ignored

Definition at line 1825 of file matrix44.h.

## rotateX()

template<typename T>

BALL_INLINE void BALL::TMatrix4x4< T >::rotateX | ( | const TAngle< T > & | phi | ) |

Rotate the matrix around the x axis.

Parameters

  phi | the rotation angle

Definition at line 1746 of file matrix44.h.

## rotateY()

template<typename T>

BALL_INLINE void BALL::TMatrix4x4< T >::rotateY | ( | const TAngle< T > & | phi | ) |

Rotate the matrix around the y axis.

Parameters

  phi | the rotation angle

Definition at line 1771 of file matrix44.h.

## rotateZ()

template<typename T>

BALL_INLINE void BALL::TMatrix4x4< T >::rotateZ | ( | const TAngle< T > & | phi | ) |

Rotate the matrix around the z axis.

Parameters

  phi | the rotation angle

Definition at line 1796 of file matrix44.h.

## scale() [1/3]

template<typename T>

void BALL::TMatrix4x4< T >::scale | ( | const T & | scale | ) |

Scale the matrix.

Parameters

  scale | the scale factor

Definition at line 1665 of file matrix44.h.

## scale() [2/3]

template<typename T>

void BALL::TMatrix4x4< T >::scale | ( | const T & | x_scale,
|  | const T & | y_scale,
|  | const T & | z_scale )

Scale the matrix.

Parameters

  x_scale | the x scale factor
  y_scale | the y scale factor
  z_scale | the z scale factor

Definition at line 1646 of file matrix44.h.

## scale() [3/3]

template<typename T>

void BALL::TMatrix4x4< T >::scale | ( | const TVector3< T > & | v | ) |

Scale the matrix.

Parameters

  v | the vector with the scale factor

Definition at line 1684 of file matrix44.h.

## set() [1/6]

template<typename T>

void BALL::TMatrix4x4< T >::set | ( | const T & | m11,
|  | const T & | m12,
|  | const T & | m13,
|  | const T & | m14,
|  | const T & | m21,
|  | const T & | m22,
|  | const T & | m23,
|  | const T & | m24,
|  | const T & | m31,
|  | const T & | m32,
|  | const T & | m33,
|  | const T & | m34,
|  | const T & | m41,
|  | const T & | m42,
|  | const T & | m43,
|  | const T & | m44 )

Assign from sixteen values of type T.

Parameters

  m11 | - m44 assigned to the components

Definition at line 875 of file matrix44.h.

## set() [2/6]

template<typename T>

void BALL::TMatrix4x4< T >::set | ( | const T & | t = (T)1 | ) |

Set the diagonal elements to the given value. All other elements are set to 0.

Parameters

  T | the value to fill with (default: 1)

Definition at line 1013 of file matrix44.h.

## set() [3/6]

template<typename T>

void BALL::TMatrix4x4< T >::set | ( | const T * | ptr | ) |

Assign from array-ptr. Assign from the first sixteen elements pointed to by ptr.

Parameters

  ptr | the array to construct from

Exceptions

  NullPointer | if ptr == 0

Definition at line 825 of file matrix44.h.

## set() [4/6]

template<typename T>

void BALL::TMatrix4x4< T >::set | ( | const T | ptr[4][4] | ) |

Assign from the first sixteen elements. pointed to by the array assigned by ptr.

Parameters

  ptr | the array to construct from

Exceptions

  NullPointer | if ptr == 0

Definition at line 839 of file matrix44.h.

## set() [5/6]

template<typename T>

void BALL::TMatrix4x4< T >::set | ( | const TMatrix4x4< T > & | m | ) |

Assign from another instance.

Parameters

  TMatrix4x4 | the TMatrix4x4 object to assign from

Definition at line 855 of file matrix44.h.

## set() [6/6]

template<typename T>

void BALL::TMatrix4x4< T >::set | ( | const TVector4< T > & | col1,
|  | const TVector4< T > & | col2,
|  | const TVector4< T > & | col3,
|  | const TVector4< T > & | col4 )

Assign from four TVector4.

Parameters

  col1 | assigned to the first column
  col2 | assigned to the second column
  col3 | assigned to the third column
  col4 | assigned to the fourth column

Definition at line 864 of file matrix44.h.

## setColumn()

template<typename T>

void BALL::TMatrix4x4< T >::setColumn | ( | Position | col,
|  | const TVector4< T > & | col_value )

Set a column of the matrix.

Parameters

  col | the number of the column (0-3)
  col_value | the new value of the col

Exceptions

  IndexOverflow | if col > 3

Definition at line 1116 of file matrix44.h.

## setIdentity()

template<typename T>

BALL_INLINE void BALL::TMatrix4x4< T >::setIdentity | ( |  | ) |

Set to an identity matrix. m11, m22, m33, m44 = 1; the other cells have the value 0;

Definition at line 994 of file matrix44.h.

## setRotation() [1/3]

template<typename T>

void BALL::TMatrix4x4< T >::setRotation | ( | const TAngle< T > & | phi,
|  | const T & | axis_x,
|  | const T & | axis_y,
|  | const T & | axis_z )

Set the matrix to a rotation matrix.

Parameters

  phi | the rotation angle
  axis_x | the x component of the axis
  axis_y | the y component of the axis
  axis_z | the z component of the axis

Definition at line 1950 of file matrix44.h.

## setRotation() [2/3]

template<typename T>

BALL_INLINE void BALL::TMatrix4x4< T >::setRotation | ( | const TAngle< T > & | phi,
|  | const TVector3< T > & | axis )

Set the matrix to a rotation matrix.

Parameters

  phi | the rotation angle
  axis | the axis vector

Definition at line 1959 of file matrix44.h.

## setRotation() [3/3]

template<typename T>

BALL_INLINE void BALL::TMatrix4x4< T >::setRotation | ( | const TAngle< T > & | phi,
|  | const TVector4< T > & | axis )

Set the matrix to a rotation matrix.

Parameters

  phi | the rotation angle
  axis | the axis vector, the fourth component of the vector is ignored

Definition at line 1968 of file matrix44.h.

## setRotationX()

template<typename T>

void BALL::TMatrix4x4< T >::setRotationX | ( | const TAngle< T > & | phi | ) |

Set the matrix to a x rotation matrix.

Parameters

  phi | the rotation angle

Definition at line 1755 of file matrix44.h.

## setRotationY()

template<typename T>

void BALL::TMatrix4x4< T >::setRotationY | ( | const TAngle< T > & | phi | ) |

Set the matrix to a y rotation matrix.

Parameters

  phi | the rotation angle

Definition at line 1780 of file matrix44.h.

## setRotationZ()

template<typename T>

void BALL::TMatrix4x4< T >::setRotationZ | ( | const TAngle< T > & | phi | ) |

Set the matrix to a z rotation matrix.

Parameters

  phi | the rotation angle

Definition at line 1805 of file matrix44.h.

## setRow()

template<typename T>

void BALL::TMatrix4x4< T >::setRow | ( | Position | row,
|  | const TVector4< T > & | row_value )

Set a row of the matrix.

Parameters

  row | the number of the row (0-3)
  row_value | the new value of the row

Exceptions

  IndexOverflow | if row > 3

Definition at line 1099 of file matrix44.h.

## setScale() [1/3]

template<typename T>

void BALL::TMatrix4x4< T >::setScale | ( | const T & | scale | ) |

Set the matrix to a scalation matrix.

Parameters

  scale | the scale factor

Definition at line 1717 of file matrix44.h.

## setScale() [2/3]

template<typename T>

void BALL::TMatrix4x4< T >::setScale | ( | const T & | x_scale,
|  | const T & | y_scale,
|  | const T & | z_scale )

Set the matrix to a scalation matrix.

Parameters

  x_scale | the x scale factor
  y_scale | the y scale factor
  z_scale | the z scale factor

Definition at line 1703 of file matrix44.h.

## setScale() [3/3]

template<typename T>

void BALL::TMatrix4x4< T >::setScale | ( | const TVector3< T > & | v | ) |

Set the matrix to a scalation matrix.

Parameters

  v | the vector with the scale factor

Definition at line 1731 of file matrix44.h.

## setTranslation() [1/2]

template<typename T>

void BALL::TMatrix4x4< T >::setTranslation | ( | const T & | x,
|  | const T & | y,
|  | const T & | z )

Set the matrix to a translation matrix.

Parameters

  x | the x-component of the translation
  y | the y-component of the translation
  z | the z-component of the translation

Definition at line 1616 of file matrix44.h.

## setTranslation() [2/2]

template<typename T>

void BALL::TMatrix4x4< T >::setTranslation | ( | const TVector3< T > & | v | ) |

Set the matrix to a translation matrix.

Parameters

  v | the vector to translate with

Definition at line 1631 of file matrix44.h.

## swap()

template<typename T>

void BALL::TMatrix4x4< T >::swap | ( | TMatrix4x4< T > & | m | ) |

Swap the contents of two instances of TMatrix4x4.

Parameters

  TMatrix4x4 | the TMatrix4x4 to swap contents with

Definition at line 1023 of file matrix44.h.

## translate() [1/2]

template<typename T>

void BALL::TMatrix4x4< T >::translate | ( | const T & | x,
|  | const T & | y,
|  | const T & | z )

Translate the matrix.

Parameters

  x | the x-component of the translation
  y | the y-component of the translation
  z | the z-component of the translation

Definition at line 1598 of file matrix44.h.

## translate() [2/2]

template<typename T>

void BALL::TMatrix4x4< T >::translate | ( | const TVector3< T > & | v | ) |

Translate the matrix.

Parameters

  v | the vector to translate with

Definition at line 1607 of file matrix44.h.

## transpose()

template<typename T>

void BALL::TMatrix4x4< T >::transpose | ( |  | ) |

Mirror the Matrix at the diagonal. All values are swaped by the mirrored value. (I.e. m12 <=> m21 , m13 <=> m31 , ...)

Definition at line 1044 of file matrix44.h.

## Member Data Documentation

## m11

template<typename T>

T BALL::TMatrix4x4< T >::m11

1st cell in the 1st row

Definition at line 672 of file matrix44.h.

## m12

template<typename T>

T BALL::TMatrix4x4< T >::m12

2nd cell in the 1st row

Definition at line 675 of file matrix44.h.

## m13

template<typename T>

T BALL::TMatrix4x4< T >::m13

3rd cell in the 1st row

Definition at line 678 of file matrix44.h.

## m14

template<typename T>

T BALL::TMatrix4x4< T >::m14

4th cell in the 1st row

Definition at line 681 of file matrix44.h.

## m21

template<typename T>

T BALL::TMatrix4x4< T >::m21

1st cell in the 2nd row

Definition at line 684 of file matrix44.h.

## m22

template<typename T>

T BALL::TMatrix4x4< T >::m22

2nd cell in the 2nd row

Definition at line 687 of file matrix44.h.

## m23

template<typename T>

T BALL::TMatrix4x4< T >::m23

3rd cell in the 2nd row

Definition at line 690 of file matrix44.h.

## m24

template<typename T>

T BALL::TMatrix4x4< T >::m24

4th cell in the 2nd row

Definition at line 693 of file matrix44.h.

## m31

template<typename T>

T BALL::TMatrix4x4< T >::m31

1st cell in the 3rd row

Definition at line 696 of file matrix44.h.

## m32

template<typename T>

T BALL::TMatrix4x4< T >::m32

2nd cell in the 3rd row

Definition at line 699 of file matrix44.h.

## m33

template<typename T>

T BALL::TMatrix4x4< T >::m33

3rd cell in the 3rd row

Definition at line 702 of file matrix44.h.

## m34

template<typename T>

T BALL::TMatrix4x4< T >::m34

4th cell in the 3rd row

Definition at line 705 of file matrix44.h.

## m41

template<typename T>

T BALL::TMatrix4x4< T >::m41

1st cell in the 4th row

Definition at line 708 of file matrix44.h.

## m42

template<typename T>

T BALL::TMatrix4x4< T >::m42

2nd cell in the 4th row

Definition at line 711 of file matrix44.h.

## m43

template<typename T>

T BALL::TMatrix4x4< T >::m43

3rd cell in the 4th row

Definition at line 714 of file matrix44.h.

## m44

template<typename T>

T BALL::TMatrix4x4< T >::m44

4th cell in the 4th row

Definition at line 717 of file matrix44.h.