Public Member Functions | Static Public Member Functions | Public Attributes

gfx3DMatrix Class Reference

This class represents a 3D transformation. More...

#include <gfx3DMatrix.h>

List of all members.

Public Member Functions

 gfx3DMatrix (void)
 Create matrix.
gfx3DMatrix operator* (const gfx3DMatrix &aMatrix) const
 Matrix multiplication.
bool operator== (const gfx3DMatrix &aMatrix) const
 Return true if this matrix and |aMatrix| are the same matrix.
PRBool Is2D (gfxMatrix *aMatrix=0L) const
 Returns true if the matrix is isomorphic to a 2D affine transformation (i.e.
PRBool IsIdentity () const
 Returns true if the matrix is the identity matrix.

Static Public Member Functions

static gfx3DMatrix From2D (const gfxMatrix &aMatrix)
 Create a 3D matrix from a gfxMatrix 2D affine transformation.
static gfx3DMatrix Translation (float aX, float aY, float aZ)
 Create a translation matrix.
static gfx3DMatrix Scale (float aFactor)
 Create a scale matrix.
static gfx3DMatrix Scale (float aX, float aY, float aZ)
 Create a scale matrix.

Public Attributes

float _11
 Matrix elements.
float _12
float _13
float _14
float _21
float _22
float _23
float _24
float _31
float _32
float _33
float _34
float _41
float _42
float _43
float _44

Detailed Description

This class represents a 3D transformation.

The matrix is laid out as follows:

_11 _12 _13 _14 _21 _22 _23 _24 _31 _32 _33 _34 _41 _42 _43 _44

This matrix is treated as row-major. Assuming we consider our vectors row vectors, this matrix type will be identical in memory to the OpenGL and D3D matrices. OpenGL matrices are column-major, however OpenGL also treats vectors as column vectors, the double transposition makes everything work out nicely.


Constructor & Destructor Documentation

gfx3DMatrix::gfx3DMatrix ( void   )  [inline]

Create matrix.


Member Function Documentation

gfx3DMatrix gfx3DMatrix::From2D ( const gfxMatrix aMatrix  )  [inline, static]

Create a 3D matrix from a gfxMatrix 2D affine transformation.

Parameters:
aMatrix gfxMatrix 2D affine transformation.
PRBool gfx3DMatrix::Is2D ( gfxMatrix aMatrix = 0L  )  const

Returns true if the matrix is isomorphic to a 2D affine transformation (i.e.

as obtained by From2D). If it is, optionally returns the 2D matrix in aMatrix.

PRBool gfx3DMatrix::IsIdentity (  )  const [inline]

Returns true if the matrix is the identity matrix.

The most important property we require is that gfx3DMatrix().IsIdentity() returns true.

gfx3DMatrix gfx3DMatrix::operator* ( const gfx3DMatrix aMatrix  )  const [inline]

Matrix multiplication.

bool gfx3DMatrix::operator== ( const gfx3DMatrix aMatrix  )  const [inline]

Return true if this matrix and |aMatrix| are the same matrix.

gfx3DMatrix gfx3DMatrix::Scale ( float  aFactor  )  [inline, static]

Create a scale matrix.

Scales uniformly along all axes.

Parameters:
aScale Scale factor
gfx3DMatrix gfx3DMatrix::Scale ( float  aX,
float  aY,
float  aZ 
) [inline, static]

Create a scale matrix.

gfx3DMatrix gfx3DMatrix::Translation ( float  aX,
float  aY,
float  aZ 
) [inline, static]

Create a translation matrix.

Parameters:
aX Translation on X-axis.
aY Translation on Y-axis.
aZ Translation on Z-axis.

Member Data Documentation

Matrix elements.


The documentation for this class was generated from the following file: