GL Studio SCECpp Runtime Library
|
#include <gls_matrix_affine_double.h>
Public Types | |
enum | RotationAxis { ROTATION_AXIS_X, ROTATION_AXIS_Y, ROTATION_AXIS_Z } |
typedef GlsFloat64 | CStyleMatrix[DIMENSION][DIMENSION] |
typedef GLfloat | GLMatrixAffineF[DIMENSION *DIMENSION] |
Public Member Functions | |
GlsMatrixAffineD (void) | |
GlsMatrixAffineD (const GlsMatrixAffineD &m) | |
GlsMatrixAffineD (const CStyleMatrix &m) | |
~GlsMatrixAffineD () | |
void | SetMatrix (const GlsMatrixAffineD &m) |
void | SetElement (const GlsUInt32 row, const GlsUInt32 col, const GlsFloat64 val) |
GlsFloat64 | GetElement (const GlsUInt32 row, const GlsUInt32 col) const |
void | LeftMultiply (const GlsMatrixAffineD &m) |
void | RightMultiply (const GlsMatrixAffineD &m) |
void | Rotate (const GlsFloat64 angle, const RotationAxis rotationAxis) |
void | Translate (const GlsVector3D &v) |
void | PopulateGLMatrixAffineF (GLMatrixAffineF &dst) const |
Static Public Member Functions | |
static GlsBool | CStyleMatrixIsIdentity (const CStyleMatrix &m) |
static GlsBool | GLMatrixAffineFIsIdentity (const GLMatrixAffineF &m) |
static void | CopyGLMatrixAffineF (GLMatrixAffineF &dst, const GLMatrixAffineF &src) |
static void | VectorMultGLMatrixAffineF (const GLMatrixAffineF &m, const GlsHomogeneousVector3D &v, GlsHomogeneousVector3D &dst) |
static void | MatrixMultGLMatrixAffineF (const GLMatrixAffineF &lhs, const GLMatrixAffineF &rhs, GLMatrixAffineF &result) |
Static Public Attributes | |
static const GlsUInt32 | DIMENSION = 4u |
static const GLMatrixAffineF | IDENTITY_MATRIX_GL |
Protected Member Functions | |
void | Initialize (void) |
void | MakeIdentity (void) |
void | Multiply (const GlsMatrixAffineD &lhs, const GlsMatrixAffineD &rhs, GlsMatrixAffineD &result) const |
Protected Attributes | |
GlsFloat64 | _data [DIMENSION *DIMENSION] |
GlsFloat64 * | _matrix [DIMENSION] |
Static Protected Attributes | |
static const GlsMatrixAffineD::CStyleMatrix | IDENTITY_MATRIX_C_STYLE |
static const GlsFloat64 | IDENTITY_MATRIX_DATA_REP [DIMENSION *DIMENSION] |
4x4 affine transformation matrix. It provides the ability to perform rotations, and translations. Results are cumulative, i.e. every rotate and translate call transforms the terms that already exist in the matrix.
typedef GlsFloat64 GlsMatrixAffineD::CStyleMatrix[DIMENSION][DIMENSION] |
C style matrix representation
affine matrix of floats in format suitable for GL
GlsMatrixAffineD::GlsMatrixAffineD | ( | void | ) |
Default constructor. The new matrix will be the identity matrix.
GlsMatrixAffineD::GlsMatrixAffineD | ( | const GlsMatrixAffineD & | m | ) |
Copy Constructor.
m | matrix to copy. |
GlsMatrixAffineD::GlsMatrixAffineD | ( | const CStyleMatrix & | m | ) |
Constructor - initialize from a CStyleMatrix
m | c style matrix with intial matrix values |
GlsMatrixAffineD::~GlsMatrixAffineD | ( | ) |
Destructor - destroy instance
|
static |
Copy a GLMatrixAffineF
dst | [out] destination GLMatrixAffineF |
src | source GLMatrixAffineF |
|
static |
Determine if the given c style matrix is the identity matrix
m | c style matrix in question |
GlsFloat64 GlsMatrixAffineD::GetElement | ( | const GlsUInt32 | row, |
const GlsUInt32 | col | ||
) | const |
Get the element in the matrix at the given row and column
row | zero based row of element ( < DIMENSION ) |
col | zero based column of element ( < DIMENSION ) |
|
static |
Determine if the given GL matrix is identity
m | matrix in question |
|
protected |
This should be called from all constructors, as it initializes the matrix column index so that matrix elements can be addressed in two dimensions, but a multiplication is not incurred when doing so.
void GlsMatrixAffineD::LeftMultiply | ( | const GlsMatrixAffineD & | m | ) |
Multiply this matrix by m where this matrix is on the left side and and m is on the right side of the multiplication, ( *this = (*this) * m )
m | matrix to multiply by |
|
protected |
Set this matrix to the identity matrix. The identity matrix is I = [Aij], where Aii = 1 and Aij = 0 for i != j. Thus, for the identity matrix, the terms off the main diagonal are all zero, and the terms on the main diagonal are all one.
|
static |
Multiply two GL matrices ( lhs, rhs ) and store in result result = ( lhs * rhs )
lhs | left hand side of multiplication |
rhs | right hand side of multiplication |
result | [out] gets resultant matrix form multiplication |
|
protected |
Multiply the two matrices ( lhs, rhs ) and store in result ( result = ( lhs * rhs )
lhs | left hand side of multiplication |
rhs | right hand side of multiplication |
result | [out] gets resultant matrix for multiplication |
void GlsMatrixAffineD::PopulateGLMatrixAffineF | ( | GLMatrixAffineF & | dst | ) | const |
populate the given GLMatrixAffineF with the values of the matrix
dst | [out] gets values of the matrix |
void GlsMatrixAffineD::RightMultiply | ( | const GlsMatrixAffineD & | m | ) |
Multiply this matrix by m where this matrix is on the right side and and m is on the left side of the multiplication, ( *this = m * (*this) )
m | matrix to multiply by |
void GlsMatrixAffineD::Rotate | ( | const GlsFloat64 | angle, |
const RotationAxis | rotationAxis | ||
) |
Perform a rotation transformation around a major axis around the origin, and combine this transformation with the existing matrix data.
angle | rotation angle in degrees |
rotationAxis | major axis of rotation |
void GlsMatrixAffineD::SetElement | ( | const GlsUInt32 | row, |
const GlsUInt32 | col, | ||
const GlsFloat64 | val | ||
) |
Set the element in the matrix at the given row and column
row | zero based row of element ( < DIMENSION ) |
col | zero based column of element ( < DIMENSION ) |
val | new value for element |
void GlsMatrixAffineD::SetMatrix | ( | const GlsMatrixAffineD & | m | ) |
copy given matrix
m | matrix in question |
void GlsMatrixAffineD::Translate | ( | const GlsVector3D & | v | ) |
Perform a translation using the given 3D vector and combine with this matrix
v | 3D vector in question |
|
static |
Multiply the given 3D homogeneous vector by the given GL matrix
m | GL matrix in question |
v | 3D homogeneous vector in question |
dst | [out] receives result ( m * v ) |
|
protected |
This is the actual matrix data stored in column-major ordering in a one-dimensional array of the appropriate size to store all matrix terms. The data is stored in this manner so that it can be passed to OpenGL matrix operations, which expect matrices to be ordered this way.
|
protected |
A column index array. Each element in this array "points" to a column of the matrix within the above data. By using this index, we can address matrix terms using two dimensions, column and row, without incurring a multiplication. Eg. matrix[0] points to a column within data, which is the address of the first term in the column. We can further address into the column and access a particular row by adding another dimension, eg. matrix[0][1]. The indices must be set up at construction time.
|
static |
matrix is DIMENSION x DIMENSION
|
staticprotected |
identity c style matrix
|
staticprotected |
identity matrix in data representation format
|
static |
identity GLMatrixAffineF matrix ( column major )