Fovia's C++ Client/Server API
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
MATRIX44D Struct Reference

Public Member Functions

MATRIX44D add (MATRIX44D B)
 
void assign (double m11, double m21, double m31, double m41, double m12, double m22, double m32, double m42, double m13, double m23, double m33, double m43, double m14, double m24, double m34, double m44)
 
void assignT (double m11, double m12, double m13, double m14, double m21, double m22, double m23, double m24, double m31, double m32, double m33, double m34, double m41, double m42, double m43, double m44)
 
VECTOR3D getOffsetVector ()
 
VECTOR3D getXVector ()
 
VECTOR3D getYVector ()
 
VECTOR3D getZVector ()
 
 MATRIX44D ()
 
 MATRIX44D (const MATRIX44D &copy)
 
 MATRIX44D (const VECTOR3D &vecX, const VECTOR3D &vecY, const VECTOR3D &vecZ, const VECTOR3D &vecLoc)
 
 MATRIX44D (double m11, double m21, double m31, double m41, double m12, double m22, double m32, double m42, double m13, double m23, double m33, double m43, double m14, double m24, double m34, double m44)
 
 MATRIX44D (double m11, double m12, double m13, double m14, double m21, double m22, double m23, double m24, double m31, double m32, double m33, double m34, double m41, double m42, double m43, double m44, bool bTransposed)
 
MATRIX44D mul (MATRIX44D B)
 
VECTOR3D mul (VECTOR3D V)
 
bool operator!= (MATRIX44D mat)
 
MATRIX44Doperator= (const MATRIX44D &r)
 
bool operator== (MATRIX44D mat)
 
void setIdentity ()
 
void setOffsetVector (const VECTOR3D &v)
 
void setOffsetVector (double x, double y, double z)
 
void setXVector (const VECTOR3D &v)
 
void setXVector (double x, double y, double z)
 
void setYVector (const VECTOR3D &v)
 
void setYVector (double x, double y, double z)
 
void setZVector (const VECTOR3D &v)
 
void setZVector (double x, double y, double z)
 
std::string toString ()
 

Static Public Member Functions

static MATRIX44D createRotateMatrix (double amt, double x, double y, double z)
 
static MATRIX44D createRotateXMatrix (double amt)
 
static MATRIX44D createRotateYMatrix (double amt)
 
static MATRIX44D createRotateZMatrix (double amt)
 
static MATRIX44D createScaleMatrix (double sx, double sy, double sz)
 
static MATRIX44D createTranslateMatrix (double tx, double ty, double tz)
 

Public Attributes

double m11
 
double m12
 
double m13
 
double m14
 
double m21
 
double m22
 
double m23
 
double m24
 
double m31
 
double m32
 
double m33
 
double m34
 
double m41
 
double m42
 
double m43
 
double m44
 

Detailed Description

A double precision 4x4 matrix. See RENDER_PARAMS::Transform for the most common usage of this type.

$ \left| \begin{array}{cccc} m11 & m12 & m13 & m14 \\ m21 & m22 & m23 & m24 \\ m31 & m32 & m33 & m34 \\ m41 & m42 & m43 & m44 \\ \end{array} \right| $

Constructor & Destructor Documentation

MATRIX44D::MATRIX44D ( )
inline

Constructs a new matrix. The member fields are not initialized.

MATRIX44D::MATRIX44D ( const MATRIX44D copy)
inline

Constructs a new matrix and copies the member fields from copy into this objects member fields.

Parameters
copyThe matrix from which to copy the member fields.
MATRIX44D::MATRIX44D ( const VECTOR3D vecX,
const VECTOR3D vecY,
const VECTOR3D vecZ,
const VECTOR3D vecLoc 
)
inline

Constructs a new matrix by populating the member fields with the corresponding orientation and offset vectors. See RENDER_PARAMS::Transform for a description of how these vectors are inserted into the matrix.

Parameters
vecXThe X orientation vector.
vecYThe Y orientation vector.
vecZThe Z orientation vector.
vecLocThe offset vector.

References VECTOR3D::x, VECTOR3D::y, and VECTOR3D::z.

MATRIX44D::MATRIX44D ( double  m11,
double  m21,
double  m31,
double  m41,
double  m12,
double  m22,
double  m32,
double  m42,
double  m13,
double  m23,
double  m33,
double  m43,
double  m14,
double  m24,
double  m34,
double  m44 
)
inline

Constructs a new matrix by populating the member fields with the corresponding input parameter.

References assign().

MATRIX44D::MATRIX44D ( double  m11,
double  m12,
double  m13,
double  m14,
double  m21,
double  m22,
double  m23,
double  m24,
double  m31,
double  m32,
double  m33,
double  m34,
double  m41,
double  m42,
double  m43,
double  m44,
bool  bTransposed 
)
inline

This is identical to the other constructor that accepts 16 doubles except that the parameter order is transposed for easy entry of matrices that are entered row-major. The bTransposed parameter is ignored. It is only there to differentiate the overloads.

References assign().

Member Function Documentation

MATRIX44D MATRIX44D::add ( MATRIX44D  B)
inline

Returns the result of adding this matrix to the matrix contained in B.

Parameters
BThe right hand side of the matrix addition operation.
Returns
The result of the matrix addition operation.
void MATRIX44D::assign ( double  m11,
double  m21,
double  m31,
double  m41,
double  m12,
double  m22,
double  m32,
double  m42,
double  m13,
double  m23,
double  m33,
double  m43,
double  m14,
double  m24,
double  m34,
double  m44 
)
inline

Assigns the values in the parameters to the member fields of this matrix.

Referenced by MATRIX44D(), operator=(), and setIdentity().

void MATRIX44D::assignT ( double  m11,
double  m12,
double  m13,
double  m14,
double  m21,
double  m22,
double  m23,
double  m24,
double  m31,
double  m32,
double  m33,
double  m34,
double  m41,
double  m42,
double  m43,
double  m44 
)
inline

Similar to the transposed constructor, this assigns the parameters into the corresponding member fields, but does so with a row-major parameter order.

static MATRIX44D MATRIX44D::createRotateMatrix ( double  amt,
double  x,
double  y,
double  z 
)
inlinestatic

Returns a new matrix that represents a rotation along the arbitrary axis specified by the x, y and z parameters. Multiplying a vector by this homogeneous matrix (see MATRIX44D::mul(VECTOR3D) ) will apply this transformation to the vector. Multiplying this matrix by another matrix (see MATRIX44D::mul(MATRIX44D) ) will concatenate them into a single matrix representing both transformations applied in the order in which they were multiplied. This can be very useful because it can save a large amount of computational time.

Parameters
xThe x component of the axis of rotation.
yThe y component of the axis of rotation.
zThe z component of the axis of rotation.
amtThe amount to rotate in radians.
Returns
The new matrix that represents the transformation.
static MATRIX44D MATRIX44D::createRotateXMatrix ( double  amt)
inlinestatic

Returns a new matrix that represents a rotation along the X axis as specified in amt. Multiplying a vector by this homogeneous matrix (see MATRIX44D::mul(VECTOR3D) ) will apply this transformation to the vector. Multiplying this matrix by another matrix (see MATRIX44D::mul(MATRIX44D) ) will concatenate them into a single matrix representing both transformations applied in the order in which they were multiplied. This can be very useful because it can save a large amount of computational time.

Parameters
amtThe amount to rotate in radians.
Returns
The new matrix that represents the transformation.
static MATRIX44D MATRIX44D::createRotateYMatrix ( double  amt)
inlinestatic

Returns a new matrix that represents a rotation along the Y axis as specified in amt. Multiplying a vector by this homogeneous matrix (see MATRIX44D::mul(VECTOR3D) ) will apply this transformation to the vector. Multiplying this matrix by another matrix (see MATRIX44D::mul(MATRIX44D) ) will concatenate them into a single matrix representing both transformations applied in the order in which they were multiplied. This can be very useful because it can save a large amount of computational time.

Parameters
amtThe amount to rotate in radians.
Returns
The new matrix that represents the transformation.
static MATRIX44D MATRIX44D::createRotateZMatrix ( double  amt)
inlinestatic

Returns a new matrix that represents a rotation along the Z axis as specified in amt. Multiplying a vector by this homogeneous matrix (see MATRIX44D::mul(VECTOR3D) ) will apply this transformation to the vector. Multiplying this matrix by another matrix (see MATRIX44D::mul(MATRIX44D) ) will concatenate them into a single matrix representing both transformations applied in the order in which they were multiplied. This can be very useful because it can save a large amount of computational time.

Parameters
amtThe amount to rotate in radians.
Returns
The new matrix that represents the transformation.
static MATRIX44D MATRIX44D::createScaleMatrix ( double  sx,
double  sy,
double  sz 
)
inlinestatic

Returns a new matrix that represents a scaling along the X, Y and Z axes as specified in sx, sy and sz respectively. Multiplying a vector by this homogeneous matrix (see MATRIX44D::mul(VECTOR3D) ) will apply this transformation to the vector. Multiplying this matrix by another matrix (see MATRIX44D::mul(MATRIX44D) ) will concatenate them into a single matrix representing both transformations applied in the order in which they were multiplied. This can be very useful because it can save a large amount of computational time.

Parameters
sxThe scaling in the X direction.
syThe scaling in the Y direction.
szThe scaling in the Z direction.
Returns
The new matrix that represents the transformation.
static MATRIX44D MATRIX44D::createTranslateMatrix ( double  tx,
double  ty,
double  tz 
)
inlinestatic

Returns a new matrix that represents a translation along the X, Y and Z axes as specified in tx, ty and tz respectively. Multiplying a vector by this homogeneous matrix (see MATRIX44D::mul(VECTOR3D) ) will apply this transformation to the vector. Multiplying this matrix by another matrix (see MATRIX44D::mul(MATRIX44D) ) will concatenate them into a single matrix representing both transformations applied in the order in which they were multiplied. This can be very useful because it can save a large amount of computational time.

Parameters
txThe translation in the X direction.
tyThe translation in the Y direction.
tzThe translation in the Z direction.
Returns
The new matrix that represents the transformation.
VECTOR3D MATRIX44D::getOffsetVector ( )
inline

Returns a VECTOR3D that represents the offset vector from this transform matrix. See RENDER_PARAMS::Transform for details on the vectors contained in a transform matrix.

Returns
The offset vector contained in this matrix.
VECTOR3D MATRIX44D::getXVector ( )
inline

Returns a VECTOR3D that represents the X orientation vector from this transform matrix. See RENDER_PARAMS::Transform for details on the vectors contained in a transform matrix.

Returns
The X vector contained in this matrix.
VECTOR3D MATRIX44D::getYVector ( )
inline

Returns a VECTOR3D that represents the Y orientation vector from this transform matrix. See RENDER_PARAMS::Transform for details on the vectors contained in a transform matrix.

Returns
The Y vector contained in this matrix.
VECTOR3D MATRIX44D::getZVector ( )
inline

Returns a VECTOR3D that represents the Z orientation vector from this transform matrix. See RENDER_PARAMS::Transform for details on the vectors contained in a transform matrix.

Returns
The Z vector contained in this matrix.
MATRIX44D MATRIX44D::mul ( MATRIX44D  B)
inline

Returns the result of multiplying this matrix by the matrix contained in B. Note that this is an $O(N^3)$ and should be optimized or paralleled if it is intended to be used on a huge number of matrices.

Parameters
BThe right hand side of the matrix multiply operation.
Returns
The result of the matrix multiply operation.
VECTOR3D MATRIX44D::mul ( VECTOR3D  V)
inline

Multiplies the vector V by this matrix in the homogeneous vector space. Specifically, V is expanded to (x,y,z,1), multiplied by this matrix, then x,y and z are divided by the 4th member of the intermediate 4D vector. The resulting x,y,z values are returned in a 3D vector.

Parameters
VThe vector to multiply through this matrix.
Returns
The result of the multiply operation.

References VECTOR3D::x, VECTOR3D::y, and VECTOR3D::z.

bool MATRIX44D::operator!= ( MATRIX44D  mat)
inline

Tests for any difference between two matrices. Note that due to the floating point nature of the matrix, the utility of this function is very limited.

Parameters
matThe matrix to which this matrix will be compared.
Returns
false if the matrices are identical, true otherwise.
MATRIX44D& MATRIX44D::operator= ( const MATRIX44D r)
inline

Assigns the values in the parameters to the member fields of this matrix.

References assign().

bool MATRIX44D::operator== ( MATRIX44D  mat)
inline

Tests for exact equality of two matrices. Note that due to the floating point nature of the matrix, the utility of this function is very limited.

Parameters
matThe matrix to which this matrix will be compared.
Returns
true if the matrices are identical, false otherwise.
void MATRIX44D::setIdentity ( )
inline

Mutable member function that assigns the identity matrix to this object.

References assign().

void MATRIX44D::setOffsetVector ( const VECTOR3D v)
inline

Sets the members fields corresponding to the offset vector in this matrix to the values contained in v.

Parameters
vThe new offset vector.

References VECTOR3D::x, VECTOR3D::y, and VECTOR3D::z.

void MATRIX44D::setOffsetVector ( double  x,
double  y,
double  z 
)
inline

Sets the members fields corresponding to the offset vector in this matrix to the values of this function's parameters.

Parameters
xThe x value of the new offset vector.
yThe y value of the new offset vector.
zThe z value of the new offset vector.
void MATRIX44D::setXVector ( const VECTOR3D v)
inline

Sets the members fields corresponding to the X orientation vector in this matrix to the values contained in v.

Parameters
vThe new X orientation vector.

References VECTOR3D::x, VECTOR3D::y, and VECTOR3D::z.

void MATRIX44D::setXVector ( double  x,
double  y,
double  z 
)
inline

Sets the members fields corresponding to the X orientation vector in this matrix to the values of this function's parameters.

Parameters
xThe x value of the new X orientation vector.
yThe y value of the new X orientation vector.
zThe z value of the new X orientation vector.
void MATRIX44D::setYVector ( const VECTOR3D v)
inline

Sets the members fields corresponding to the Y orientation vector in this matrix to the values contained in v.

Parameters
vThe new Y orientation vector.

References VECTOR3D::x, VECTOR3D::y, and VECTOR3D::z.

void MATRIX44D::setYVector ( double  x,
double  y,
double  z 
)
inline

Sets the members fields corresponding to the Y orientation vector in this matrix to the values of this function's parameters.

Parameters
xThe x value of the new Y orientation vector.
yThe y value of the new Y orientation vector.
zThe z value of the new Y orientation vector.
void MATRIX44D::setZVector ( const VECTOR3D v)
inline

Sets the members fields corresponding to the Z orientation vector in this matrix to the values contained in v.

Parameters
vThe new Z orientation vector.

References VECTOR3D::x, VECTOR3D::y, and VECTOR3D::z.

void MATRIX44D::setZVector ( double  x,
double  y,
double  z 
)
inline

Sets the members fields corresponding to the Z orientation vector in this matrix to the values of this function's parameters.

Parameters
xThe x value of the new Z orientation vector.
yThe y value of the new Z orientation vector.
zThe z value of the new Z orientation vector.
std::string MATRIX44D::toString ( )
inline

Returns a string describing the values contained in this object.

Returns
The string describing this object.