CMat4D Class Reference

Matrix class. More...

#include <CMat4D.h>

List of all members.

Public Member Functions

 CMat4D (void)
 CMat4D (const CV4D &, const CV4D &, const CV4D &, const CV4D &)
 CMat4D (const double *)
 CMat4D (double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double)
 CMat4D (const CMat4D &)
 ~CMat4D (void)
const CMat4Doperator= (const CMat4D &)
const CMat4Doperator= (const double a)
CMat4Doperator+= (const CMat4D &m)
CMat4Doperator-= (const CMat4D &m)
CMat4Doperator *= (const CMat4D &)
CMat4D operator+ (const CMat4D &) const
CMat4D operator- (const CMat4D &) const
CMat4D operator * (const CMat4D &m) const
CMat4D operator * (double scalar) const
bool operator== (const CMat4D &m) const
bool operator!= (const CMat4D &m) const
double operator() (int i, int j) const
CV4D operator[] (int i) const
CV4D operator() (int j) const
const double * getArray ()
void clear (void)
void setValues (double *field)
double getCoeff (int i, int j) const
void setCoeff (int i, int j, double value)
CMat4D getTransposed (void) const
CMat4D getInverted (void) const
bool invert (void)
void transpose (void)
void print (void)
void setIdentity (void)
CV4D getRow (int)
CV4D getCol (int)
void setRow (int nRow, const CV4D &)
void setCol (int nCol, const CV4D &)
void setRows (const CV4D &, const CV4D &, const CV4D &, const CV4D &)
void setCols (const CV4D &, const CV4D &, const CV4D &, const CV4D &)
void setScaling (const CV4D &)
void setScaling (const CV3D &)
void setScaling (double, double, double)
void setTranslation (const CV4D &)
void setTranslation (const CV3D &)
void setTranslation (double, double, double)
void setRotation (CV4D &, double)
void setRotation (CV3D &, double)
void setRotation (CQuat &)

Static Public Member Functions

static CMat4D PIdentity (void)
static CMat4D PTranslate (const CV4D &)
static CMat4D PTranslate (const CV3D &)
static CMat4D PTranslate (double, double, double)
static CMat4D PScale (const CV4D &)
static CMat4D PScale (const CV3D &)
static CMat4D PScale (double, double, double)
static CMat4D PRotate (const CV4D &, double)
static CMat4D PRotate (const CV3D &, double)
static CMat4D PRotate (CQuat &)

Private Member Functions

double * get1DField (void)
double ** get2DField (void)

Private Attributes

double m_ardValues [16]

Friends

CV4D operator * (const CMat4D &, const CV4D &)
CP4D operator * (const CMat4D &, const CP4D &)
CMat4D operator * (double, const CMat4D &)
CMat4D operator * (const CMat4D &M, double rdFactor)
friend::ostream & operator<< (::ostream &s, const CMat4D &m)


Detailed Description

Matrix class.

Note: CMat4D objects are handled in classic mathematical manner, i.e. to "transform a vector" multiply it like Tv - i.e. we have column vectors multiplied from the right side. [richi]


Constructor & Destructor Documentation

CMat4D::CMat4D ( void   ) 

Default Constructor.

CMat4D::CMat4D ( const CV4D ,
const CV4D ,
const CV4D ,
const CV4D  
)

Construct new matrix with the values passed by the vectors. The values of 'col1' are put in the first column, the values of 'col2' are put to the second column and so on.

CMat4D::CMat4D ( const double *   ) 

Construct new matrix with the values passed in '*field'. The first four values of the array passed by 'field' are stored in the first column of the matrix and so on.

CMat4D::CMat4D ( double  ,
double  ,
double  ,
double  ,
double  ,
double  ,
double  ,
double  ,
double  ,
double  ,
double  ,
double  ,
double  ,
double  ,
double  ,
double   
)

Construct new matrix with values passed in [] order.

CMat4D::CMat4D ( const CMat4D  ) 

Copy constructor.

CMat4D::~CMat4D ( void   ) 

Default Destructor.


Member Function Documentation

void CMat4D::clear ( void   ) 

Initialize the matrix with 0.

double * CMat4D::get1DField ( void   )  [private]

Returns a one dimensional array of the matrix elements.

double ** CMat4D::get2DField ( void   )  [private]

Returns a two dimensional array of the matrix elements.

const double* CMat4D::getArray (  )  [inline]

Returns the pointer to the array of the matrix.

double CMat4D::getCoeff ( int  i,
int  j 
) const

Returns the element in the i-th row and j-th coloumn.

CV4D CMat4D::getCol ( int   ) 

Returns the column of the matrix (0 through 3).

CMat4D CMat4D::getInverted ( void   )  const

CV4D CMat4D::getRow ( int   ) 

Returns the row of the matrix (0 through 3).

CMat4D CMat4D::getTransposed ( void   )  const

Tranpose the matrix.

bool CMat4D::invert ( void   ) 

invert this matrix

CMat4D CMat4D::operator * ( double  scalar  )  const

Multiplication of a matrix with a scalar.

CMat4D CMat4D::operator * ( const CMat4D m  )  const

Multiplication of a matrix (this) with another matrix.

CMat4D & CMat4D::operator *= ( const CMat4D  ) 

Multiplication of a matrix with this matrix.

bool CMat4D::operator!= ( const CMat4D m  )  const

boolean operator ( NOT EQUAL )

CV4D CMat4D::operator() ( int  j  )  const

Returns the j-th column of the matrix.

double CMat4D::operator() ( int  i,
int  j 
) const

Returns the element in the i-th row and j-th coloumn.

CMat4D CMat4D::operator+ ( const CMat4D  )  const

Addition of two matrices.

CMat4D & CMat4D::operator+= ( const CMat4D m  ) 

Add matrix to this matrix

CMat4D CMat4D::operator- ( const CMat4D  )  const

Subtraction of two matrices.

CMat4D & CMat4D::operator-= ( const CMat4D m  ) 

const CMat4D & CMat4D::operator= ( const double  a  ) 

Set the diagonal to the passed value.

const CMat4D & CMat4D::operator= ( const CMat4D  ) 

Assign one matrix to another.

bool CMat4D::operator== ( const CMat4D m  )  const

boolean operator ( EQUAL )

CV4D CMat4D::operator[] ( int  i  )  const

Returns the i-th row of the matrix.

CMat4D CMat4D::PIdentity ( void   )  [static]

Construtor for identity matrix.

void CMat4D::print ( void   ) 

Print the matrix to standard output.

CMat4D CMat4D::PRotate ( CQuat  )  [static]

Construtor generating identity matrix with rotation defined by the quaternion.

CMat4D CMat4D::PRotate ( const CV3D ,
double   
) [static]

Construtor generating identity matrix with rotation around an axis by a certain angle in rad.

CMat4D CMat4D::PRotate ( const CV4D ,
double   
) [static]

Construtor generating identity matrix with rotation around an axis by a certain angle in rad. Please note that only x, y, and z of the vector are used, w is omitted.

CMat4D CMat4D::PScale ( double  ,
double  ,
double   
) [static]

Construtor generating identity matrix with scaling by a vector.

CMat4D CMat4D::PScale ( const CV3D  )  [static]

Construtor generating identity matrix with scaling by a vector.

CMat4D CMat4D::PScale ( const CV4D  )  [static]

Construtor generating identity matrix with scaling by a vector. Please note, only x, y, and z of the vector are used. W is omitted.

CMat4D CMat4D::PTranslate ( double  ,
double  ,
double   
) [static]

Construtor generating identity matrix with a translatation by a vector.

CMat4D CMat4D::PTranslate ( const CV3D  )  [static]

Construtor generating identity matrix with a translatation by a vector.

CMat4D CMat4D::PTranslate ( const CV4D  )  [static]

Construtor generating identity matrix with a translatation by a vector. Please note, only x, y, and z of the vector are used. W is omitted.

void CMat4D::setCoeff ( int  i,
int  j,
double  value 
)

Sets the element in the i-th row and j-th coloumn.

void CMat4D::setCol ( int  nCol,
const CV4D  
)

Sets the specified column of the matrix with the given vector.

void CMat4D::setCols ( const CV4D ,
const CV4D ,
const CV4D ,
const CV4D  
)

Sets all four columns of the matrix with the given vectors.

void CMat4D::setIdentity ( void   ) 

Set matrix to identity.

void CMat4D::setRotation ( CQuat  ) 

Rotates using the given quaternion.

void CMat4D::setRotation ( CV3D ,
double   
)

Rotates around an axis by a certain angle.

void CMat4D::setRotation ( CV4D ,
double   
)

Rotates around an axis by a certain angle.

void CMat4D::setRow ( int  nRow,
const CV4D  
)

Sets the specified row of the matrix with the given vector.

void CMat4D::setRows ( const CV4D ,
const CV4D ,
const CV4D ,
const CV4D  
)

Sets all four rows of the matrix with the given vectors.

void CMat4D::setScaling ( double  ,
double  ,
double   
)

Sets the scaling of the matrix (diagonal elements). Note Before this, the matrix is cleard and afterwards, the fourth diagonal element is set to 1!!!

void CMat4D::setScaling ( const CV3D  ) 

Sets the scaling of the matrix (diagonal elements). Note Before this, the matrix is cleard and afterwards, the fourth diagonal element is set to 1!!!

void CMat4D::setScaling ( const CV4D  ) 

Sets the scaling of the matrix (diagonal elements). Note Before this, the matrix is cleard and afterwards, the fourth diagonal element is set to 1!!!

void CMat4D::setTranslation ( double  ,
double  ,
double   
)

Sets the scaling of the matrix (diagonal elements). Note Before this, the matrix is cleard and afterwards, the fourth element in the last row is set to 1!!!

void CMat4D::setTranslation ( const CV3D  ) 

Sets the scaling of the matrix (diagonal elements). Note Before this, the matrix is cleard and afterwards, the fourth element in the last row is set to 1!!!

void CMat4D::setTranslation ( const CV4D  ) 

Sets the scaling of the matrix (diagonal elements). Note Before this, the matrix is cleard and afterwards, the fourth element in the last row is set to 1!!!

void CMat4D::setValues ( double *  field  ) 

Set the coefficient of the matrix to the values given in *field. The first four values of the array passed by 'field' are stored in the first column of the matrix and so on.

void CMat4D::transpose ( void   ) 

transpose this matrix


Friends And Related Function Documentation

CMat4D operator * ( const CMat4D M,
double  rdFactor 
) [friend]

Multiplication of a scalar with a matrix.

CMat4D operator * ( double  rdScalar,
const CMat4D m 
) [friend]

Multiplication of a matrix with a scalar.

CP4D operator * ( const CMat4D m,
const CP4D p 
) [friend]

Multiplication of a matrix with a point.

CV4D operator * ( const CMat4D m,
const CV4D v 
) [friend]

Multiplication of a matrix with a vector.

::ostream& operator<< ( ::ostream &  s,
const CMat4D m 
) [friend]

Print the matrix to output stream.


Member Data Documentation

double CMat4D::m_ardValues[16] [private]


The documentation for this class was generated from the following files:
Generated on Mon Jul 10 22:37:39 2006 for QGLViewer by  doxygen 1.4.7