QSDK 1.1 Documentation
Main Page | Modules | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members | Related Pages

Maths::Matrix4f Struct Reference
[Matrices]

#include <Q/maths.h>

Inheritance diagram for Maths::Matrix4f:

Maths::TransformFlags List of all members.

Public Member Functions

 Matrix4f ()
 Matrix4f (const Matrix4f &src)
 Matrix4f (const Affine4f &src)
unsigned int getflags () const
unsigned int getflags (unsigned int mask) const
void setflags (unsigned int f)
void addflags (unsigned int f)
void clearflags (unsigned int f)
int isIdentity () const
int isTranslated () const
int isRotated () const
int isScaled () const
void buildFlags (float eps)
float frobeniusNormSquared () const
void set (const Matrix4f &src)
Matrix4foperator= (const Matrix4f &src)
void set (const Affine4f &src)
Matrix4foperator= (const Affine4f &src)
Vec4foperator[] (unsigned int i)
const Vec4foperator[] (unsigned int i) const
const Vec3fup () const
const Vec3fdirection () const
const Vec3fposition () const
const Vec3fside () const
void clearW ()
void setIdentity ()
void setRotation (const Vec3f &axis, float angle)
void setRotation (const Quat4f &quat)
void setRotation (const Vec3f &dir, const Vec3f &up)
void setRotation (const Matrix3f &rot)
void setQuaternion (const Quat4f &q)
void position (const Vec3f &p)
void scale (float)
void scale (const Vec3f &)
void clearPosition ()
void clearRotation ()
void product (const Matrix4f &a, const Matrix4f &b)
void add (const Matrix4f &a, const Matrix4f &b)
void subtract (const Matrix4f &a, const Matrix4f &b)
void invert (const Matrix4f &from)
void invertOrthonormal (const Matrix4f &from)
void invertAffine (const Matrix4f &from)
void invertGeneral (const Matrix4f &from)
void inverseProduct (const Matrix4f &aMat, const Matrix4f &bMat)
void transpose (const Matrix4f &from)
int operator== (const Matrix4f &mat) const
Matrix4f operator * (const Matrix4f &b) const
Matrix4f operator+ (const Matrix4f &b) const
Matrix4f operator- (const Matrix4f &b) const
Matrix4foperator *= (const Matrix4f &b)
Matrix4f inverseProduct (const Matrix4f &m) const
Matrix4f invert () const
Matrix4f transpose () const

Public Attributes

Vec4x4 m

Detailed Description

A 4 by 4 matrix of floats, mainly designed for storing 3 dimensional transforms and a set of flags indicating the type of contents of the matrix.

The matrix should always be manipulated using the methods on it. Direct access to the values is available, but if values are modified in this way then care should be taken to update the TransformFlags accordingly, otherwise incorrect results can occur from some of the mathmatical operations.


Constructor & Destructor Documentation

Maths::Matrix4f::Matrix4f  )  [inline]
 

Create an uninitialised matrix. If values are to be loaded into the matrix by means of the modifiers, then it is adivsed that setIdentity is first called to initialise the matrix.

Maths::Matrix4f::Matrix4f const Matrix4f src  )  [inline]
 

Copy the matrix from src

Maths::Matrix4f::Matrix4f const Affine4f src  )  [inline]
 

Copy the matrix from src


Member Function Documentation

void Maths::Matrix4f::add const Matrix4f a,
const Matrix4f b
 

Set this matrix to be the sum of a and b (a + b). This matrix can be either of the input matrices, without consequence.

void Maths::Matrix4f::addflags unsigned int  f  )  [inline]
 

Combine (Or) the flags into the current TransformFlags.

void Maths::Matrix4f::buildFlags float  eps  ) 
 

Recalculate the flags field given an error epsilon for comparison to the identity.

void Maths::Matrix4f::clearflags unsigned int  f  )  [inline]
 

Clear the given flags from the TransformFlags.

void Maths::Matrix4f::clearPosition  ) 
 

Set the translation part to the origin.

void Maths::Matrix4f::clearRotation  ) 
 

Set the rotation part to the identity rotation.

void Maths::Matrix4f::clearW  )  [inline]
 

Clear W terms to affine values.

const Vec3f& Maths::Matrix4f::direction  )  const [inline]
 

Return the direction vector of the rotation of the matrix.

float Maths::Matrix4f::frobeniusNormSquared  )  const
 

A helper functions used by buildFlags.

unsigned int Maths::Matrix4f::getflags unsigned int  mask  )  const [inline]
 

Return the value of the TransformFlags, using the given mask,

unsigned int Maths::Matrix4f::getflags  )  const [inline]
 

Return the value of the TransformFlags

void Maths::Matrix4f::inverseProduct const Matrix4f aMat,
const Matrix4f bMat
 

Set this matrix to be the product of aMat and the inverse of bMat.

void Maths::Matrix4f::invert const Matrix4f from  ) 
 

Set this matrix to be the inverse of from. This matrix should be different from the input matrix.

void Maths::Matrix4f::invertAffine const Matrix4f from  ) 
 

Helper function called from invert based on the value of the TransformFlags.

void Maths::Matrix4f::invertGeneral const Matrix4f from  ) 
 

Helper function called from invert based on the value of the TransformFlags.

void Maths::Matrix4f::invertOrthonormal const Matrix4f from  ) 
 

Helper function called from invert based on the value of the TransformFlags.

int Maths::Matrix4f::isIdentity  )  const [inline]
 

Returns whether the flags indicate that the matrix is an identity.

int Maths::Matrix4f::isRotated  )  const [inline]
 

Returns whether the flags indicate that the matrix has a rotation part in it.

int Maths::Matrix4f::isScaled  )  const [inline]
 

Returns whether the flags indicate that the matrix has any scale applied to it.

int Maths::Matrix4f::isTranslated  )  const [inline]
 

Returns whether the flags indicate that the matrix has entries in the translation fields.

void Maths::Matrix4f::position const Vec3f p  ) 
 

Set the translation part of the matrix, leaving the rotation part unchanged.

const Vec3f& Maths::Matrix4f::position  )  const [inline]
 

Return the translation vector of matrix.

void Maths::Matrix4f::product const Matrix4f a,
const Matrix4f b
 

Set this matrix to be the product of a and b (a * b). Although this matrix can be the same as either of the input matrices, it should be noted that doing this will result in a loss of performance, as a temporary matrix will need to be used in the calculation.

void Maths::Matrix4f::scale const Vec3f  ) 
 

Apply a non-uniform scale to the matrix.

void Maths::Matrix4f::scale float   ) 
 

Apply a uniform scale factor to the matrix.

void Maths::Matrix4f::setflags unsigned int  f  )  [inline]
 

Set the TransformFlags to the given value.

void Maths::Matrix4f::setIdentity  ) 
 

Set the matrix to the the identity.

void Maths::Matrix4f::setQuaternion const Quat4f q  )  [inline]
 

Deprecated:
Use setRotation(const Quat4f& quat)

void Maths::Matrix4f::setRotation const Matrix3f rot  ) 
 

Set the rotation part of the matrix as defined by the rotation matrix rot. The translation part of the matrix is unaltered.

void Maths::Matrix4f::setRotation const Vec3f dir,
const Vec3f up
 

Set the rotation part of the matrix. The translation part of the matrix is unaltered.

Parameters:
dir The direction vector of the rotation.
up The up vector of the rotation. This does not need to be orthogonal to the direction vector, it will be adjusted within the plane, defined by dir and up, to produce an orthogonal vector. Therefore, the only restriction is that dir and up are not co-linear.

void Maths::Matrix4f::setRotation const Quat4f quat  ) 
 

Set the rotation part of the matrix as defined by quat. The translation part of the matrix is unaltered.

void Maths::Matrix4f::setRotation const Vec3f axis,
float  angle
 

Set the rotation part of the matrix. The translation part of the matrix is unaltered.

Parameters:
axis The direction vector of the rotation.
angle The rotation in radians about the direction vector to define the up vector of the rotation.

const Vec3f& Maths::Matrix4f::side  )  const [inline]
 

Return the side vector of the rotation of the matrix.

void Maths::Matrix4f::subtract const Matrix4f a,
const Matrix4f b
 

Set this matrix to be difference of the 2 matrices (a - b). This matrix can be either of the input matrices, without consequence.

void Maths::Matrix4f::transpose const Matrix4f from  ) 
 

Set this matrix to he the transpose of from.

const Vec3f& Maths::Matrix4f::up  )  const [inline]
 

Return the up vector of the rotation of the matrix.

Return to QSDK documentation Contents page. Contact details for support, information and fault-reporting.
Qube Software Limited © 2000-2004