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

TMatrix3x3 Class Template Reference
[Math3x3]

Template class for 3x3 matrix. More...

#include <gmlmatrix3.h>

List of all members.

Public Member Functions

Det ()
TMatrix3x3< T > MultVectStr (TVector3< T > &v1, TVector3< T > &v2)
Constructors
 TMatrix3x3 ()
 No initialization.

 TMatrix3x3 (T r)
 Initialization by diagonal element.

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

 TMatrix3x3 (T a00, T a01, T a02, T a10, T a11, T a12, T a20, T a21, T a22)
 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,1) = 20)

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

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 TVector2< T > &t)
 Set translation part of this matrix to values of vector t.

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

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

void SetRotation (const TMatrix3x3< T > &mat)
 Set rotation part of the matrix (a 2x2 upper left corner).

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

TMatrix3x3< T > GetRotation () const
 Return rotation part of this matrix (a 2x2 upper left corner).

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

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

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

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

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

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

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

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

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

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

TMatrix3x3< T > & operator/= (const double d)
TMatrix3x3< T > operator *= (const double d)
TMatrix3x3< T > operator/ (const double d)
TMatrix3x3< T > operator= (const TMatrix3x3< T > &mat)
Matrix-2-Vector operations
void MultMatrixVec (const TVector2< T > &src, TVector2< T > &dst) const
 dst = M * src

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

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

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

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 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 TVector2< T > &src, TVector2< T > &dst) const
 dst = src * M (only rotation and scale part, no translation)

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

Miscellaneous
Multiplication by scalar r (diagonal)

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

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

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


Static Public Member Functions

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


Protected Attributes

m [9]

Friends

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

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

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


Related Functions

(Note that these are not member functions.)

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

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

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


Detailed Description

template<class T>
class gml::TMatrix3x3< T >

Template class for 3x3 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 a3 a6 a1 a4 a7 a2 a5 a8


Member Function Documentation

T* RawArray  )  [inline]
 

Provide access to internal contents.

Warning:
Use with care, this function is dangerous!

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

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

Translation part is the 3-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