Main Page | Modules | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

TMatrix4x4 Class Template Reference
[Math4x4]

Template class for 4x4 matrix. More...

#include <gmlmatrix4.h>

List of all members.

Public Member Functions

Constructors
 TMatrix4x4 ()
 No initialization.

 TMatrix4x4 (T r)
 Initialization by diagonal element.

 TMatrix4x4 (const T *m)
 Initialization by array of T.

 TMatrix4x4 (T a00, T a01, T a02, T a03, T a10, T a11, T a12, T a13, T a20, T a21, T a22, T a23, T a30, T a31, T a32, T a33)
 Direct initialization by components (row order).

Access to values
T * RawArray ()
 Provide access to internal contents.

void GetValue (T *mp) const
 Copy this matrix mp array (! column-major order).

const T * GetValue () const
 Provide const access to the buffer.

void SetValue (const T *mp)
 Copy data from mp array.

void SetValue (T r)
 Initialization by a diagonal component.

T & operator() (int row, int col)
 access operator (e.g. m(2,3) = 20)

const T & operator() (int row, int col) const
 const access operator (e.g. a = m(2,3))

T & Elem (int row, int col)
 Return (row, col) element.

const T & Elem (int row, int col) const
 Return const (row, col) element.

Row and column access
void SetScale (T s)
 Set scale components of this matrix to the same value s.

void SetScale (const TVector3< T > &s)
 Set scale components of this matrix to values from vector s.

void SetTranslation (const TVector3< T > &t)
 Set translation part of this matrix to values of vector t.

void GetTranslation (TVector3< T > &t) const
 Set vector t to translation part of this matrix.

TVector3< T > GetTranslation () const
 Return translation part of this matrix.

void SetRotation (const TMatrix4x4< T > &mat)
 Set rotation part of the matrix (a 3x3 upper left corner).

void GetRotation (TMatrix4x4< T > &mat) const
 Set mat to rotation part of this matrix.

TMatrix4x4< T > GetRotation () const
 Return rotation part of this matrix (a 3x3 upper left corner).

void SetRow (int r, const TVector4< T > &t)
 Set row r of this matrix to vector t.

void SetColumn (int c, const TVector4< T > &t)
 Set column c of this matrix to vector t.

void GetRow (int r, TVector4< T > &t) const
 Set vector t equal to row r of this matrix.

TVector4< T > GetRow (int r) const
 Return row r.

void GetColumn (int c, TVector4< T > &t) const
 Set vector t equal to column c of this matrix.

TVector4< T > GetColumn (int c) const
 Return column c.

Matrix-2-Matrix operations
TMatrix4x4< T > & MultRight (const TMatrix4x4< T > &b)
 Multiplication to matrix b (right).

TMatrix4x4< T > & MultLeft (const TMatrix4x4< T > &b)
 Multiplication to matrix b (left).

TMatrix4x4< T > & operator *= (const TMatrix4x4< T > &mat)
 this *= mat

TMatrix4x4< T > & operator+= (const TMatrix4x4< T > &mat)
 this += mat

Matrix-2-Vector operations
void MultMatrixVec (const TVector3< T > &src, TVector3< T > &dst) const
 dst = M * src

void MultMatrixVec (TVector3< T > &src_and_dst) const
 src_and_dst = M * src_and_dst

void MultVecMatrix (const TVector3< T > &src, TVector3< T > &dst) const
 dst = src * M

void MultVecMatrix (TVector3< T > &src_and_dst) const
 src_and_dst = src_and_dst * M

void MultMatrixVec (const TVector4< T > &src, TVector4< T > &dst) const
 dst = M * src

void MultMatrixVec (TVector4< T > &src_and_dst) const
 src_and_dst = M * src_and_dst

void MultVecMatrix (const TVector4< T > &src, TVector4< T > &dst) const
 dst = src * M

void MultVecMatrix (TVector4< T > &src_and_dst) const
 src_and_dst = src_and_dst * M

void MultMatrixDir (const TVector3< T > &src, TVector3< T > &dst) const
 dst = M * src (only rotation and scale part, no translation)

void MultMatrixDir (TVector3< T > &src_and_dst) const
 src_and_dst = M * src_and_dst (only rotation and scale part, no translation)

void MultDirMatrix (const TVector3< T > &src, TVector3< T > &dst) const
 dst = src * M (only rotation and scale part, no translation)

void MultDirMatrix (TVector3< T > &src_and_dst) const
 src_and_dst = src_and_dst * M (only rotation and scale part, no translation)

Matrix-2-Scalar operations
TMatrix4x4< T > & operator *= (const T &r)
 Multiplication by scalar r (diagonal).

Miscellaneous
void MakeIdentity ()
 Make E-matrix from this one.

TMatrix4x4< T > Inverse () const
 Return an inverse matrix.

TMatrix4x4< T > Transpose () const
 Return transposed matrix.

void Ortho (double left, double right, double bottom, double top, double znear, double zfar)

Static Public Member Functions

const TMatrix4x4< T > & Identity ()
 Return predefined identity matrix.


Protected Attributes

m [16]

Friends

TMatrix4x4< T > operator * (const TMatrix4x4< T > &m1, const TMatrix4x4< T > &m2)
 Matrix multiplication (return m1 * m2).

bool operator== (const TMatrix4x4< T > &m1, const TMatrix4x4< T > &m2)
 Equality operator.

bool operator!= (const TMatrix4x4< T > &m1, const TMatrix4x4< T > &m2)
 Unequality operator.


Related Functions

(Note that these are not member functions.)

TMatrix4x4< T_TO > Conv (const TMatrix4x4< T_FROM > &u)
 Convert TMatrix4x4<T_FROM> to TMatrix4x4<T_TO>.

TMatrix4x4< float > ConvF (const TMatrix4x4< T > &u)
 Convert TMatrix4x4<T> to TMatrix4x4<float>.

TMatrix4x4< double > ConvD (const TMatrix4x4< T > &u)
 Convert TMatrix4x4<T> to TMatrix4x4<double>.


Detailed Description

template<class T>
class gml::TMatrix4x4< T >

Template class for 4x4 matrix.

Parameters:
T - template type of matrix elements
Warning:
Use it with some SIGNED integral type, or a real type Elements are stored in column-major order (OpenGL-style) E.g.:
a0 a4 a8 a12 a1 a5 a9 a13 a2 a6 a10 a14 a3 a7 a11 a15


Member Function Documentation

T* RawArray  )  [inline]
 

Provide access to internal contents.

Warning:
Use with care, this function is dangerous!

void SetTranslation const TVector3< T > &  t  )  [inline]
 

Set translation part of this matrix to values of vector t.

Translation part is the 4-th column, so it is valid for use with column-vectors V = M * V; V = (v1 v2 v3 v4)T

See also:
MultMatrixVec


The documentation for this class was generated from the following file:
Generated on Tue Jan 13 21:12:07 2004 for Graphics and Media Lab CSL by doxygen 1.3.4