KrisLibrary  1.0.0
Public Member Functions | Public Attributes | List of all members
Math3D::Matrix4 Class Reference

A 4x4 matrix class. More...

#include <primitives.h>

Public Member Functions

 Matrix4 (const Matrix4 &)
 
 Matrix4 (Real)
 
 Matrix4 (const Real[4][4])
 
 Matrix4 (const Real *)
 
 Matrix4 (const Vector3 &xb, const Vector3 &yb, const Vector3 &zb, const Vector3 &trans)
 
 Matrix4 (const Vector4 &x, const Vector4 &y, const Vector4 &z, const Vector4 &w)
 
 Matrix4 (const Matrix3 &)
 
 Matrix4 (const Matrix3 &, const Vector3 &trans)
 
 Matrix4 (const Vector3 &trans)
 
bool operator== (const Matrix4 &) const
 
bool operator!= (const Matrix4 &) const
 
const Matrix4operator= (const Matrix4 &)
 
void operator+= (const Matrix4 &)
 
void operator-= (const Matrix4 &)
 
void operator*= (const Matrix4 &)
 
void operator*= (Real scale)
 
void operator/= (Real scale)
 
 operator Matrix3 () const
 
 operator const Real * () const
 
Real & operator() (int i, int j)
 
const Real & operator() (int i, int j) const
 
void set (const Matrix4 &)
 
void set (Real)
 
void set (const Real[4][4])
 
void set (const Real *)
 
void set (const Vector3 &xb, const Vector3 &yb, const Vector3 &zb, const Vector3 &trans)
 
void set (const Vector4 &x, const Vector4 &y, const Vector4 &z, const Vector4 &w)
 
void set (const Matrix3 &)
 sets the upper 3x3 matrix
 
void set (const Matrix3 &, const Vector3 &trans)
 sets the upper 3x3 matrix and the upper 3x1 vector (making an affine 3D transformation)
 
void setZero ()
 
void setIdentity ()
 
void setDiagonal (const Vector4 &)
 
void setTranslate (const Vector3 &trans)
 
void setTranspose (const Matrix4 &)
 
void setNegative (const Matrix4 &)
 
bool setInverse (const Matrix4 &)
 
void setOuterProduct (const Vector4 &a, const Vector4 &b)
 this = a*b^t
 
void get (Matrix4 &) const
 
void get (Real[4][4]) const
 
void get (Real[16]) const
 
void get (Vector3 &xb, Vector3 &yb, Vector3 &zb, Vector3 &trans) const
 
void get (Vector4 &x, Vector4 &y, Vector4 &z, Vector4 &w) const
 
void get (Matrix3 &) const
 
void get (Matrix3 &, Vector3 &) const
 
void getTranspose (Matrix4 &) const
 
void getNegative (Matrix4 &) const
 
bool getInverse (Matrix4 &) const
 
void inplaceTranspose ()
 
void inplaceNegative ()
 
bool inplaceInverse ()
 
void inplaceMul (Real s)
 
void inplaceDiv (Real s)
 
bool isZero (Real eps=Zero) const
 
bool isIdentity (Real eps=Zero) const
 
bool isEqual (const Matrix4 &, Real eps=Zero) const
 
bool isInvertible (Real eps=Zero) const
 
Real cofactor (int i, int j) const
 
Real determinant () const
 
Real trace () const
 
Real minElement (int *i=NULL, int *j=NULL) const
 
Real maxElement (int *i=NULL, int *j=NULL) const
 
Real minAbsElement (int *i=NULL, int *j=NULL) const
 
Real maxAbsElement (int *i=NULL, int *j=NULL) const
 
bool Read (File &)
 
bool Write (File &) const
 
Real * col (int j)
 
Real * col1 ()
 
Real * col2 ()
 
Real * col3 ()
 
Real * col4 ()
 
const Real * col (int j) const
 
const Real * col1 () const
 
const Real * col2 () const
 
const Real * col3 () const
 
const Real * col4 () const
 
void setCol (int j, const Vector4 &v)
 
void setCol1 (const Vector4 &v)
 
void setCol2 (const Vector4 &v)
 
void setCol3 (const Vector4 &v)
 
void setCol4 (const Vector4 &v)
 
void setCol (int j, const Vector3 &v)
 
void setCol1 (const Vector3 &v)
 
void setCol2 (const Vector3 &v)
 
void setCol3 (const Vector3 &v)
 
void setCol4 (const Vector3 &v)
 
void setRow (int i, const Vector4 &v)
 
void setRow1 (const Vector4 &v)
 
void setRow2 (const Vector4 &v)
 
void setRow3 (const Vector4 &v)
 
void setRow4 (const Vector4 &v)
 
void setRow (int i, const Vector3 &v)
 
void setRow1 (const Vector3 &v)
 
void setRow2 (const Vector3 &v)
 
void setRow3 (const Vector3 &v)
 
void setRow4 (const Vector3 &v)
 
void getCol (int j, Vector4 &v) const
 
void getCol1 (Vector4 &v) const
 
void getCol2 (Vector4 &v) const
 
void getCol3 (Vector4 &v) const
 
void getCol4 (Vector4 &v) const
 
void getCol (int j, Vector3 &v) const
 
void getCol1 (Vector3 &v) const
 
void getCol2 (Vector3 &v) const
 
void getCol3 (Vector3 &v) const
 
void getCol4 (Vector3 &v) const
 
void getRow (int i, Vector4 &v) const
 
void getRow1 (Vector4 &v) const
 
void getRow2 (Vector4 &v) const
 
void getRow3 (Vector4 &v) const
 
void getRow4 (Vector4 &v) const
 
void getRow (int i, Vector3 &v) const
 
void getRow1 (Vector3 &v) const
 
void getRow2 (Vector3 &v) const
 
void getRow3 (Vector3 &v) const
 
void getRow4 (Vector3 &v) const
 
Vector3 getXBasis () const
 the following are for 4x4 homogeneous transforms
 
Vector3 getYBasis () const
 
Vector3 getZBasis () const
 
Vector3 getTranslation () const
 
matrix ops (this = a op b)
void add (const Matrix4 &a, const Matrix4 &b)
 
void sub (const Matrix4 &a, const Matrix4 &b)
 
void mul (const Matrix4 &a, const Matrix4 &b)
 
void mulTransposeA (const Matrix4 &a, const Matrix4 &b)
 
void mulTransposeB (const Matrix4 &a, const Matrix4 &b)
 
scalar ops (this = a op b)
void mul (const Matrix4 &a, Real b)
 
void div (const Matrix4 &a, Real b)
 
void mul (const Vector4 &a, Vector4 &out) const
 
void mulTranspose (const Vector4 &a, Vector4 &out) const
 
homogeneous vector ops (4th coord is homogeneous coord)
void mulPoint (const Vector3 &a, Vector3 &out) const
 assumes w = 1
 
void mulVector (const Vector3 &a, Vector3 &out) const
 assumes w = 0
 
void mulVectorTranspose (const Vector3 &a, Vector3 &out) const
 

Public Attributes

Real data [4][4]
 column major format
 

Detailed Description

A 4x4 matrix class.

The elements can be accessed as (i,j) for i,j in [0,3].

WARNING: For historical reasons, the data array data[2][2] is in column major format, e.g. data[i][j] = element (j,i).


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