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

A 3x3 matrix class. More...

#include <primitives.h>

Public Member Functions

 Matrix3 (const Matrix3 &)
 
 Matrix3 (Real)
 
 Matrix3 (const Real[3][3])
 
 Matrix3 (const Real *)
 
 Matrix3 (const Vector3 &xb, const Vector3 &yb, const Vector3 &zb)
 
bool operator== (const Matrix3 &) const
 
bool operator!= (const Matrix3 &) const
 
const Matrix3operator= (const Matrix3 &)
 
void operator+= (const Matrix3 &)
 
void operator-= (const Matrix3 &)
 
void operator*= (const Matrix3 &)
 
void operator*= (Real scale)
 
void operator/= (Real scale)
 
 operator const Real * () const
 
Real & operator() (int i, int j)
 
const Real & operator() (int i, int j) const
 
void set (const Matrix3 &)
 
void set (Real)
 
void set (const Real[3][3])
 
void set (const Real[9])
 
void set (const Vector3 &xb, const Vector3 &yb, const Vector3 &zb)
 
void setZero ()
 
void setIdentity ()
 
void setDiagonal (const Vector3 &)
 
void setTranspose (const Matrix3 &)
 
void setNegative (const Matrix3 &)
 
bool setInverse (const Matrix3 &)
 
void setScale (Real s)
 
void setScale (Real sx, Real sy, Real sz)
 
void setCrossProduct (const Vector3 &)
 sets the matrix that performs the vector cross product
 
void setRotateX (Real rads)
 sets the matrix that rotates ccw by rads around the x axis
 
void setRotateY (Real rads)
 sets the matrix that rotates ccw by rads around the x axis
 
void setRotateZ (Real rads)
 sets the matrix that rotates ccw by rads around the x axis
 
void setOuterProduct (const Vector3 &a, const Vector3 &b)
 this = a*b^t
 
void get (Matrix3 &) const
 
void get (Real[3][3]) const
 
void get (Real[9]) const
 
void get (Vector3 &xb, Vector3 &yb, Vector3 &zb) const
 
void getTranspose (Matrix3 &) const
 
void getNegative (Matrix3 &) const
 
bool getInverse (Matrix3 &) const
 
void getCrossProduct (Vector3 &) const
 if this is a cross-product matrix, returns the vector that performs the cross product
 
void inplaceTranspose ()
 
void inplaceNegative ()
 
bool inplaceInverse ()
 
void inplaceMul (Real s)
 
void inplaceDiv (Real s)
 
void inplaceRowScale (Real sx, Real sy, Real sz)
 
void inplaceColScale (Real sx, Real sy, Real sz)
 
bool isZero (Real eps=Zero) const
 
bool isIdentity (Real eps=Zero) const
 
bool isEqual (const Matrix3 &, 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 ()
 
const Real * col (int j) const
 
const Real * col1 () const
 
const Real * col2 () const
 
const Real * col3 () const
 
void setCol (int j, const Vector3 &v)
 
void setCol1 (const Vector3 &v)
 
void setCol2 (const Vector3 &v)
 
void setCol3 (const Vector3 &v)
 
void setRow (int i, const Vector3 &v)
 
void setRow1 (const Vector3 &v)
 
void setRow2 (const Vector3 &v)
 
void setRow3 (const Vector3 &v)
 
void getCol (int j, Vector3 &v) const
 
void getCol1 (Vector3 &v) const
 
void getCol2 (Vector3 &v) const
 
void getCol3 (Vector3 &v) const
 
void getRow (int i, Vector3 &v) const
 
void getRow1 (Vector3 &v) const
 
void getRow2 (Vector3 &v) const
 
void getRow3 (Vector3 &v) const
 
Vector3 getXBasis () const
 
Vector3 getYBasis () const
 
Vector3 getZBasis () const
 
Vector2 getXBasis2D () const
 
Vector2 getYBasis2D () const
 
Vector2 getTranslation2D () const
 
matrix ops (this = a op b)
void add (const Matrix3 &a, const Matrix3 &b)
 
void sub (const Matrix3 &a, const Matrix3 &b)
 
void mul (const Matrix3 &a, const Matrix3 &b)
 
void mulTransposeA (const Matrix3 &a, const Matrix3 &b)
 
void mulTransposeB (const Matrix3 &a, const Matrix3 &b)
 
void mul (const Matrix3 &a, Real b)
 
void div (const Matrix3 &a, Real b)
 
vector ops (out = this op a)
void mul (const Vector3 &a, Vector3 &out) const
 Note: result is incorrect if out = a.
 
void mulTranspose (const Vector3 &a, Vector3 &out) const
 
homogeneous vector ops (3rd coord is homogeneous coord)
void mulPoint (const Vector2 &a, Vector2 &out) const
 assumes w = 1
 
void mulVector (const Vector2 &a, Vector2 &out) const
 assumes w = 0
 
void mulVectorTranspose (const Vector2 &a, Vector2 &out) const
 

Public Attributes

Real data [3][3]
 column major format
 

Detailed Description

A 3x3 matrix class.

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

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: