gfx::Matrix Class Reference

Matrix class. More...

#include <gfx_math_matrix.hh>

List of all members.

Public Types

typedef fp FPM
 fp precision
typedef FPM ElemType
 element type

Public Member Functions

 Matrix (void)
 Default identity matrix.
FPMoperator[] (uint i)
const FPMoperator[] (uint i) const
Vector3 GetOrigin (void) const
void SetOrigin (const Vector3 &origin)
void Convert (fp out[16]) const
void Identity (void)
FPM RotateX (FPM x, FPM y, FPM z) const
FPM RotateY (FPM x, FPM y, FPM z) const
FPM RotateZ (FPM x, FPM y, FPM z) const
template<typename VECTOR_DEST, typename VECTOR_SRC>
VECTOR_DEST Rotate (const VECTOR_SRC &v) const
FPM RotateTranslateX (FPM x, FPM y, FPM z) const
FPM RotateTranslateY (FPM x, FPM y, FPM z) const
FPM RotateTranslateZ (FPM x, FPM y, FPM z) const
template<typename DEST, typename SRC>
DEST RotateTranslate (const SRC &v) const
template<typename DEST, typename SRC>
void RotateTranslate (Array< DEST > &dest, const Array< SRC > &src) const
 Rotate then translate (array). Auto-expands destination array.
template<typename DEST, typename SRC>
DEST TranslateRotate (const SRC &src) const
template<typename DEST, typename SRC>
void TranslateRotate (Array< DEST > &dest, const Array< SRC > &src) const
 Translate then rotate. Auto-expands destination array.
WorldVertex Transform (const LocalVertex &v) const
 local --> world
void Transform (Array< WorldVertex > &dest, const Array< LocalVertex > &src) const
EyeVertex Transform (const WorldVertex &v) const
 world --> eye
void Transform (Array< EyeVertex > &dest, const Array< WorldVertex > &src) const
void Transform (Array< EyeVertex > &dest, const Array< LocalVertex > &src) const
 local --> eye
template<typename VECTOR>
VECTOR MoveFixed (uint axis, fp inc) const
template<typename VECTOR>
VECTOR MoveLocal (uint axis, fp inc) const
void TranslateFixed (uint axis, FPM inc)
void TranslateLocal (uint axis, FPM inc)
void RotateFixed (uint axis, Radian rad)
void RotateLocal (uint axis, Radian rad)
FPMPTR (void) const
const FPMCONST_PTR (void) const

Private Member Functions

uint MIXF (uint i, uint j) const
uint MIXL (uint i, uint j) const

Private Attributes

FPM m [12]

Friends

bool operator== (const Matrix &m1, const Matrix &m2)
 Compare matrixs.
bool operator!= (const Matrix &m1, const Matrix &m2)
 Compare matrixs.
bool IfRotationEqual (const Matrix &m1, const Matrix &m2)
 Compare rotation/orientation elements of two matrixs (excludes origin).
ostream & operator<< (ostream &strm, const Matrix &m)


Detailed Description

Matrix class.

Names of methods may seem vague but the arg types indicate whether the matrix or coords/vertexs are involved. Transform() translates then rotates (used for vertex transformation). RotateTranslate() means rotate then translate (for transforming matrix itself).


Member Typedef Documentation

typedef fp gfx::Matrix::FPM

fp precision

typedef FPM gfx::Matrix::ElemType

element type


Constructor & Destructor Documentation

gfx::Matrix::Matrix ( void   )  [inline]

Default identity matrix.


Member Function Documentation

FPM& gfx::Matrix::operator[] ( uint  i  )  [inline]

const FPM& gfx::Matrix::operator[] ( uint  i  )  const [inline]

Vector3 gfx::Matrix::GetOrigin ( void   )  const [inline]

void gfx::Matrix::SetOrigin ( const Vector3 origin  )  [inline]

void gfx::Matrix::Convert ( fp  out[16]  )  const [inline]

void gfx::Matrix::Identity ( void   )  [inline]

Assign matrix with identity mapping.

FPM gfx::Matrix::RotateX ( FPM  x,
FPM  y,
FPM  z 
) const [inline]

Rotate coordinates.

FPM gfx::Matrix::RotateY ( FPM  x,
FPM  y,
FPM  z 
) const [inline]

FPM gfx::Matrix::RotateZ ( FPM  x,
FPM  y,
FPM  z 
) const [inline]

template<typename VECTOR_DEST, typename VECTOR_SRC>
VECTOR_DEST gfx::Matrix::Rotate ( const VECTOR_SRC &  v  )  const [inline]

Rotate vector. Example: mMatrix.Rotate<EyeVertex,WorldVertex>( wv );

FPM gfx::Matrix::RotateTranslateX ( FPM  x,
FPM  y,
FPM  z 
) const [inline]

Rotate then translate a coordinate.

FPM gfx::Matrix::RotateTranslateY ( FPM  x,
FPM  y,
FPM  z 
) const [inline]

FPM gfx::Matrix::RotateTranslateZ ( FPM  x,
FPM  y,
FPM  z 
) const [inline]

template<typename DEST, typename SRC>
DEST gfx::Matrix::RotateTranslate ( const SRC &  v  )  const [inline]

Rotate then translate.

template<typename DEST, typename SRC>
void gfx::Matrix::RotateTranslate ( Array< DEST > &  dest,
const Array< SRC > &  src 
) const [inline]

Rotate then translate (array). Auto-expands destination array.

template<typename DEST, typename SRC>
DEST gfx::Matrix::TranslateRotate ( const SRC &  src  )  const [inline]

Translate then rotate.

template<typename DEST, typename SRC>
void gfx::Matrix::TranslateRotate ( Array< DEST > &  dest,
const Array< SRC > &  src 
) const [inline]

Translate then rotate. Auto-expands destination array.

WorldVertex gfx::Matrix::Transform ( const LocalVertex v  )  const [inline]

local --> world

Transform vertex. Transform() is a mnemonic for RotateTranslate() or TranslateRotate() and which is inferred from arg type. To transform from local to eye space, this matrix would be the product of matrix multiplication of a Dyna matrix and Eye matrix.

void gfx::Matrix::Transform ( Array< WorldVertex > &  dest,
const Array< LocalVertex > &  src 
) const [inline]

EyeVertex gfx::Matrix::Transform ( const WorldVertex v  )  const [inline]

world --> eye

void gfx::Matrix::Transform ( Array< EyeVertex > &  dest,
const Array< WorldVertex > &  src 
) const [inline]

void gfx::Matrix::Transform ( Array< EyeVertex > &  dest,
const Array< LocalVertex > &  src 
) const [inline]

local --> eye

template<typename VECTOR>
VECTOR gfx::Matrix::MoveFixed ( uint  axis,
fp  inc 
) const [inline]

For moving a vector along one axis of a matrix. Similar to TranslateFixed() and TranslateLocal().

template<typename VECTOR>
VECTOR gfx::Matrix::MoveLocal ( uint  axis,
fp  inc 
) const [inline]

void gfx::Matrix::TranslateFixed ( uint  axis,
FPM  inc 
) [inline]

Translate a matrix along an axis in fixed space. For translating the eye/viewpoint.

void gfx::Matrix::TranslateLocal ( uint  axis,
FPM  inc 
) [inline]

Translate a matrix along its own axis. For translating a Dyna.

void gfx::Matrix::RotateFixed ( uint  axis,
Radian  rad 
) [inline]

Rotate a matrix around a fixed axis. This function is suited to rotating the viewpoint/eye. The word "fixed" should be clear by looking at the math. Eg, the value of the X coord won't be changed by a rotation around the X axis.

void gfx::Matrix::RotateLocal ( uint  axis,
Radian  rad 
) [inline]

Rotate matrix around local axis. Rotate a local coordinate system around its own axis. This function is suited to rotating an independent object. The rotation is relative to local coodinate system (not the fixed/eye system). The trick is to load an identity-mapped matrix and rotate it, then transform it thru the given matrix (which defines the local coordinate system) as though it was the coords (1.0, 1.0, 1.0). These coords of course define the X,Y,Z axises. The transformation is effectively a local rotation.

FPM* gfx::Matrix::PTR ( void   )  const [inline]

const FPM* gfx::Matrix::CONST_PTR ( void   )  const [inline]

uint gfx::Matrix::MIXF ( uint  i,
uint  j 
) const [inline, private]

uint gfx::Matrix::MIXL ( uint  i,
uint  j 
) const [inline, private]


Friends And Related Function Documentation

bool operator== ( const Matrix m1,
const Matrix m2 
) [friend]

Compare matrixs.

bool operator!= ( const Matrix m1,
const Matrix m2 
) [friend]

Compare matrixs.

bool IfRotationEqual ( const Matrix m1,
const Matrix m2 
) [friend]

Compare rotation/orientation elements of two matrixs (excludes origin).

ostream& operator<< ( ostream &  strm,
const Matrix m 
) [friend]


Member Data Documentation

FPM gfx::Matrix::m[12] [private]


The documentation for this class was generated from the following file: Palomino 3D Engine documents generated by doxygen 1.5.3 on Fri Nov 23 11:26:27 2007