OV::OVm4 Class Reference

4x4 floting point matrix class. Container for 4x4 floating point matrices with access operators. More...

#include <ovalgebra.h>


Public Member Functions

 OVm4 ()
 Empty constructor, sets identity matrix.
 OVm4 (float *m)
 Constructor from array of 16 floats.
 OVm4 (float e00, float e01, float e02, float e03, float e10, float e11, float e12, float e13, float e20, float e21, float e22, float e23, float e30, float e31, float e32, float e33)
 Constructor from 16 elements.
 ~OVm4 ()
 Destructor.
 operator float * ()
 Automatic typecast operator. Enables use of OVm4 in glFunc[v]() functions.
float & operator[] (int index)
 Linear access operator. 'int' and 'unsigned int' as well as const declared versions avaliable.
float & operator[] (unsigned int index)
const float & operator[] (int index) const
const float & operator[] (unsigned int index) const
float & operator() (int row, int col)
 Access operator. 'int' and 'unsigned int' as well as const declared versions avaliable.
float & operator() (unsigned int row, unsigned int col)
const float & operator() (int row, int col) const
const float & operator() (unsigned int row, unsigned int col) const
OVm4 operator * (const float f)
 Operator for multiplication with scalar.
OVv4 operator * (const OVv4 &v)
 Operator for multiplication with vector. This function could easily be re-implemented using an array of floats instead of OV4f.
OVm4 operator * (const OVm4 &a)
 Operator for multiplication with 4x4 matrix. This function could easily be re-implemented using an array of floats instead of OVm4.
void operator= (const float *a)
 = operator. This function could easily be re-implemented using an array of floats instead of OVm3.
OVv16 Get ()
 Use only if OV16f is wanted, else use overloaded typecast (OVm4 -> float*).
OVv4 GetRow (int index)
 Access operator for entire row of matrix.
OVv4 GetCol (int index)
 Access operator for entire column of matrix.
void Set (float *a)
 Sets matrix elements.
void SetRow (int index, float *v)
 Sets one row of matrix elements.
void SetCol (int index, float *v)
 Sets one column of matrix elements.
void Print ()
 Prints matrix to commandline.
void Clear ()
 Clears matrix to 0.
void SetToIdentityMatrix ()
 Sets matrix to identity.
void SetToTranslationMatrix (float tx, float ty, float tz)
 Sets matrix to translation matrix. Multiplication will perform a translation of (tx,ty,tz) units.
void SetToRotationMatrix (float theta, float x, float y, float z)
 Sets matrix to rotation matrix. Multiplication will perform a rotation of theta degrees (radians?) around (x,y,z) axis.
float GetDeterminant ()
 Determinant of object matrix.
OVm4 GetTranspose ()
 Transpose of object matrix.
OVm4 GetInverse ()
 Inverse of object matrix. Using adjoint transpose matrices to calculate inverse.

Protected Member Functions

float Det3x3 (float &e00, float &e01, float &e02, float &e10, float &e11, float &e12, float &e20, float &e21, float &e22)
 Determinant of any 3x3 matrix.
float Det4x4 (float &e00, float &e01, float &e02, float &e03, float &e10, float &e11, float &e12, float &e13, float &e20, float &e21, float &e22, float &e23, float &e30, float &e31, float &e32, float &e33)
 Determinant of any 4x4 matrix. Using piecewise 3x3 determinants.

Private Attributes

float e [16]


Detailed Description

4x4 floting point matrix class. Container for 4x4 floating point matrices with access operators.


Constructor & Destructor Documentation

OV::OVm4::OVm4 (  )  [inline]

Empty constructor, sets identity matrix.

OV::OVm4::OVm4 ( float *  m  )  [inline]

Constructor from array of 16 floats.

OV::OVm4::OVm4 ( float  e00,
float  e01,
float  e02,
float  e03,
float  e10,
float  e11,
float  e12,
float  e13,
float  e20,
float  e21,
float  e22,
float  e23,
float  e30,
float  e31,
float  e32,
float  e33 
)

Constructor from 16 elements.

Parameters:
eXX = eRC, element (R,C) in matrix.

OV::OVm4::~OVm4 (  )  [inline]

Destructor.


Member Function Documentation

OV::OVm4::operator float * (  )  [inline]

Automatic typecast operator. Enables use of OVm4 in glFunc[v]() functions.

Returns:
Returns pointer to first element in matrix

float& OV::OVm4::operator[] ( int  index  )  [inline]

Linear access operator. 'int' and 'unsigned int' as well as const declared versions avaliable.

Parameters:
index Linear index of element.
Returns:
Returns indexed element.

float& OV::OVm4::operator[] ( unsigned int  index  )  [inline]

const float& OV::OVm4::operator[] ( int  index  )  const [inline]

const float& OV::OVm4::operator[] ( unsigned int  index  )  const [inline]

float& OV::OVm4::operator() ( int  row,
int  col 
) [inline]

Access operator. 'int' and 'unsigned int' as well as const declared versions avaliable.

Parameters:
row Row index of element.
col Column index of element.
Returns:
Returns indexed element.

float& OV::OVm4::operator() ( unsigned int  row,
unsigned int  col 
) [inline]

const float& OV::OVm4::operator() ( int  row,
int  col 
) const [inline]

const float& OV::OVm4::operator() ( unsigned int  row,
unsigned int  col 
) const [inline]

OVm4 OV::OVm4::operator * ( const float  f  ) 

Operator for multiplication with scalar.

Parameters:
f Constant scalar.
Returns:
Returns result of multiplication as OVm4 matrix.

OVv4 OV::OVm4::operator * ( const OVv4 v  ) 

Operator for multiplication with vector. This function could easily be re-implemented using an array of floats instead of OV4f.

Parameters:
v Constant reference to vector.
Returns:
Returns result of multiplication as OV4f vector.

OVm4 OV::OVm4::operator * ( const OVm4 a  ) 

Operator for multiplication with 4x4 matrix. This function could easily be re-implemented using an array of floats instead of OVm4.

Parameters:
m Constant reference to matrix.
Returns:
Returns result of multiplication as OVm4 matrix.

void OV::OVm4::operator= ( const float *  a  ) 

= operator. This function could easily be re-implemented using an array of floats instead of OVm3.

Parameters:
m Constant reference to matrix.

OVv16 OV::OVm4::Get (  )  [inline]

Use only if OV16f is wanted, else use overloaded typecast (OVm4 -> float*).

Returns:
Returns elements as vector (compatible with float*).

OVv4 OV::OVm4::GetRow ( int  index  ) 

Access operator for entire row of matrix.

Parameters:
index Row index.
Returns:
Returns indexed row as OV3f vector.

OVv4 OV::OVm4::GetCol ( int  index  ) 

Access operator for entire column of matrix.

Parameters:
index Column index.
Returns:
Returns indexed column as OV3f vector.

void OV::OVm4::Set ( float *  a  ) 

Sets matrix elements.

Parameters:
a Array of 16 floats.

void OV::OVm4::SetRow ( int  index,
float *  v 
)

Sets one row of matrix elements.

Parameters:
index Row index.
v Contains the elements to which the row should be set

void OV::OVm4::SetCol ( int  index,
float *  v 
)

Sets one column of matrix elements.

Parameters:
index Column index.
v Contains the elements to which the column should be set

void OV::OVm4::Print (  ) 

Prints matrix to commandline.

void OV::OVm4::Clear (  ) 

Clears matrix to 0.

void OV::OVm4::SetToIdentityMatrix (  ) 

Sets matrix to identity.

void OV::OVm4::SetToTranslationMatrix ( float  tx,
float  ty,
float  tz 
)

Sets matrix to translation matrix. Multiplication will perform a translation of (tx,ty,tz) units.

Parameters:
tx Translation in x.
ty Translation in y.
tz Translation in z.

void OV::OVm4::SetToRotationMatrix ( float  theta,
float  x,
float  y,
float  z 
)

Sets matrix to rotation matrix. Multiplication will perform a rotation of theta degrees (radians?) around (x,y,z) axis.

Parameters:
theta Angle of rotation.
x x-coordinate of rotation axis.
y y-coordinate of rotation axis.
z y-coordinate of rotation axis.

float OV::OVm4::GetDeterminant (  ) 

Determinant of object matrix.

Returns:
Scalar value of determinant.

OVm4 OV::OVm4::GetTranspose (  ) 

Transpose of object matrix.

Returns:
Transpose OVm4 matrix.

OVm4 OV::OVm4::GetInverse (  ) 

Inverse of object matrix. Using adjoint transpose matrices to calculate inverse.

Returns:
Inverse OVm4 matrix.

float OV::OVm4::Det3x3 ( float &  e00,
float &  e01,
float &  e02,
float &  e10,
float &  e11,
float &  e12,
float &  e20,
float &  e21,
float &  e22 
) [inline, protected]

Determinant of any 3x3 matrix.

Parameters:
eXX eXX = eRC, element (R,C) in matrix.
Returns:
Scalar value of determinant.

float OV::OVm4::Det4x4 ( float &  e00,
float &  e01,
float &  e02,
float &  e03,
float &  e10,
float &  e11,
float &  e12,
float &  e13,
float &  e20,
float &  e21,
float &  e22,
float &  e23,
float &  e30,
float &  e31,
float &  e32,
float &  e33 
) [inline, protected]

Determinant of any 4x4 matrix. Using piecewise 3x3 determinants.

Parameters:
eXX eXX = eRC, element (R,C) in matrix.
Returns:
Scalar value of determinant.


Field Documentation

float OV::OVm4::e[16] [private]

Array of matrix elements.


The documentation for this class was generated from the following files:
Generated on Thu May 17 20:28:04 2007 for Ocean View by  doxygen 1.5.2