libProcTer::CMatrix Class Reference

#include <cmatrix.h>

List of all members.

Public Member Functions

 CMatrix ()
 Default constructor. Initializes the matrix as unit matrix.
 CMatrix (CMatrix const &val)
 Copy constructor.
 ~CMatrix ()
 Destructor.
void reset ()
 Resets the matrix (makes it a unit matrix).
void setCrossProduct (CVector v)
 Makes a matrix that represents a cross product with vector v.
void setRotation (CVector v)
CVector getRotation () const
CMatrix const & operator= (CMatrix const &val)
 Assignment operator.
CMatrix const & operator*= (CMatrix const &val)
 Matrix-matrix multiplication.
CMatrix const & operator*= (double val)
 Matrix-scalar multiplication.
CMatrix const & operator/= (CMatrix const &val)
CMatrix operator* (CMatrix const &val) const
 Matrix-matrix multiplication.
CMatrix transpose () const
CVector const operator* (CVector val) const
 Matrix-vector multiplication.
CVector const operator/ (CVector val) const
CMatrix const operator* (double val) const
 Matrix-scalar multiplication.
CMatrix const operator/ (double val) const
 Matrix-scalar division.
void rotX (double hoek)
 Make a rotation matrix for rotating around the X-axis.
void rotY (double hoek)
 Make a rotation matrix for rotating around the Y-axis.
void rotZ (double hoek)
 Make a rotation matrix for rotating around the Z-axis.
void targetZ (CVector d, bool normalize=true)
void fixRotationMatrix ()
 Fixes inaccuracies in a rotation matrix.
double Element (int i, int j) const
 Get element i,j of the matrix.
void setElement (int i, int j, double e)
 Set element i,j of the matrix.
const double * gl_mtr () const

Protected Attributes

double * m_M
 Matrix data.


Detailed Description

Author:
CJP
3x3 Matrix-class. Can be used for all kinds of linear transformations on vectors, and especially for rotations.

The internal storage is 4x4, which makes it easy to use this class in combination with e.g. OpenGL. The fourth row and column are filled like those in a unit matrix.


Constructor & Destructor Documentation

libProcTer::CMatrix::CMatrix (  ) 

Default constructor. Initializes the matrix as unit matrix.

libProcTer::CMatrix::CMatrix ( CMatrix const &  val  ) 

Copy constructor.

libProcTer::CMatrix::~CMatrix (  ) 

Destructor.


Member Function Documentation

double libProcTer::CMatrix::Element ( int  i,
int  j 
) const

Get element i,j of the matrix.

void libProcTer::CMatrix::fixRotationMatrix (  ) 

Fixes inaccuracies in a rotation matrix.

CVector libProcTer::CMatrix::getRotation (  )  const

Reconstructs the rotation vector from a rotation matrix. Inverse of setRotation.

const double* libProcTer::CMatrix::gl_mtr (  )  const

Return a pointer to the internal matrix data. Useful e.g. in combination with OpenGL.

CMatrix const libProcTer::CMatrix::operator* ( double  val  )  const

Matrix-scalar multiplication.

CVector const libProcTer::CMatrix::operator* ( CVector  val  )  const

Matrix-vector multiplication.

CMatrix libProcTer::CMatrix::operator* ( CMatrix const &  val  )  const

Matrix-matrix multiplication.

CMatrix const& libProcTer::CMatrix::operator*= ( double  val  ) 

Matrix-scalar multiplication.

CMatrix const& libProcTer::CMatrix::operator*= ( CMatrix const &  val  ) 

Matrix-matrix multiplication.

CMatrix const libProcTer::CMatrix::operator/ ( double  val  )  const

Matrix-scalar division.

CVector const libProcTer::CMatrix::operator/ ( CVector  val  )  const

Transposed matrix-vector multiplication. Equivalent to transpose().operator*(val).

CMatrix const& libProcTer::CMatrix::operator/= ( CMatrix const &  val  ) 

Transposed matrix-matrix multiplication. Equivalent to operator*=(val.transpose()).

CMatrix const& libProcTer::CMatrix::operator= ( CMatrix const &  val  ) 

Assignment operator.

void libProcTer::CMatrix::reset (  ) 

Resets the matrix (makes it a unit matrix).

void libProcTer::CMatrix::rotX ( double  hoek  ) 

Make a rotation matrix for rotating around the X-axis.

void libProcTer::CMatrix::rotY ( double  hoek  ) 

Make a rotation matrix for rotating around the Y-axis.

void libProcTer::CMatrix::rotZ ( double  hoek  ) 

Make a rotation matrix for rotating around the Z-axis.

void libProcTer::CMatrix::setCrossProduct ( CVector  v  ) 

Makes a matrix that represents a cross product with vector v.

void libProcTer::CMatrix::setElement ( int  i,
int  j,
double  e 
)

Set element i,j of the matrix.

void libProcTer::CMatrix::setRotation ( CVector  v  ) 

Makes a rotation matrix from a vector v. The direction of v is the rotation axis, and the size of v is the rotation angle in radians.

void libProcTer::CMatrix::targetZ ( CVector  d,
bool  normalize = true 
)

Make a rotation matrix that points the Z-axis in the direction D. Useful for cameras.

CMatrix libProcTer::CMatrix::transpose (  )  const

Returns the transpose of the matrix. Note that for rotation matrices, the transpose is also the inverse.


Member Data Documentation

double* libProcTer::CMatrix::m_M [protected]

Matrix data.


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

Generated on Sun Aug 2 13:23:11 2009 for libprocter by  doxygen 1.5.8