GL Studio C++ Runtime API
GlsMatrixAffine< Type > Class Template Reference

#include <gls_matrix_affine.h>

Inheritance diagram for GlsMatrixAffine< Type >:
GlsMatrix< Type, 4 >

Public Types

typedef GlsMatrix< Type, 4 > _BaseClass
 Deprecated typedef for the base class.
 
typedef GlsMatrix< Type, 4 > BaseClass
 Typedef for the base class.
 
- Public Types inherited from GlsMatrix< Type, 4 >
typedef Type CStyleMatrix[DIM][DIM]
 Typedef for a 4x4 matrix stored as a 2D array.
 

Public Member Functions

 GlsMatrixAffine ()
 
 GlsMatrixAffine (const Type m[4][4])
 
 GlsMatrixAffine (const Type *m)
 
 GlsMatrixAffine (const GlsMatrix< Type, 4 > &m)
 
 ~GlsMatrixAffine ()
 
bool IsVeryClose (const GlsMatrix< Type, 4 > &b) const
 
void Rotate (Type angle, RotationAxis axis)
 
void Rotate (Type angle, const Vector &centerOfRotation, RotationAxis axis)
 
void Rotate (Type angle, const Vector &centerOfRotation, const Vector &axis)
 
void Scale (Type x, Type y, Type z)
 
void Scale (Type x, Type y, Type z, const Vector &anchor)
 
void Translate (Type x, Type y, Type z)
 
void Translate (const Vector &v)
 
Vector operator* (const Vector &v) const
 
Vertex operator* (const Vertex &v) const
 
void Transform (Vector &v) const
 
- Public Member Functions inherited from GlsMatrix< Type, 4 >
 GlsMatrix ()
 
 GlsMatrix (const CStyleMatrix m)
 
 GlsMatrix (const Type *m)
 
 GlsMatrix (const GlsMatrix< Type, DIM > &m)
 
virtual ~GlsMatrix ()
 
void Dump () const
 
void Clear ()
 
Type * Data ()
 
const Type * Data () const
 
void MakeIdentity ()
 
Type Determinant () const
 
GlsMatrix< Type, DIM > Inverse () const
 
void Invert ()
 
GlsMatrix< Type, DIM > Transposition () const
 
void Transpose ()
 
bool IsDiagonal () const
 
bool IsIdentity () const
 
bool IsScalar () const
 
bool IsSingular () const
 
bool IsSymmetric () const
 
bool IsSkewSymmetric () const
 
bool IsLowerTriangular () const
 
bool IsUpperTriangular () const
 
Type & operator() (unsigned row, unsigned col)
 
Type operator() (unsigned row, unsigned col) const
 
bool operator== (const GlsMatrix< Type, DIM > &rhs) const
 
bool operator!= (const GlsMatrix< Type, DIM > &rhs) const
 
GlsMatrix< Type, DIM > & operator= (const GlsMatrix< Type, DIM > &m)
 
GlsMatrix< Type, DIM > & operator= (const CStyleMatrix m)
 
GlsMatrix< Type, DIM > operator+ () const
 
GlsMatrix< Type, DIM > operator+ (const GlsMatrix< Type, DIM > &rhs) const
 
GlsMatrix< Type, DIM > operator- () const
 
GlsMatrix< Type, DIM > operator- (const GlsMatrix< Type, DIM > &rhs) const
 
GlsMatrix< Type, DIM > & operator+= (const GlsMatrix< Type, DIM > &rhs)
 
GlsMatrix< Type, DIM > & operator-= (const GlsMatrix< Type, DIM > &rhs)
 
GlsMatrix< Type, DIM > & operator*= (const GlsMatrix< Type, DIM > &rhs)
 
GlsMatrix< Type, DIM > & operator*= (Type scalar)
 
GlsMatrix< double, 4 > & operator*= (const GlsMatrix< double, 4 > &rhs)
 
GlsMatrix< float, 4 > & operator*= (const GlsMatrix< float, 4 > &rhs)
 
GlsMatrix< Type, DIM > & operator/= (Type scalar)
 
GlsMatrix< Type, DIM > operator* (const GlsMatrix< Type, DIM > &rhs) const
 
GlsMatrix< Type, DIM > operator* (Type scalar) const
 
GlsMatrix< double, 4 > operator* (const GlsMatrix< double, 4 > &rhs) const
 
GlsMatrix< float, 4 > operator* (const GlsMatrix< float, 4 > &rhs) const
 
GlsMatrix< Type, DIM > operator/ (Type scalar) const
 

Additional Inherited Members

- Protected Member Functions inherited from GlsMatrix< Type, 4 >
void Initialize ()
 
int Pivot (unsigned row)
 
bool closeValues (Type lv, Type rv) const
 
- Protected Attributes inherited from GlsMatrix< Type, 4 >
Type _data [DIM *DIM]
 
Type * _matrix [DIM]
 
- Static Protected Attributes inherited from GlsMatrix< Type, 4 >
static const double PRECISION
 

Detailed Description

template<class Type>
class disti::GlsMatrixAffine< Type >

The GlsMatrixAffine class provides support for a 4x4 affine transformation matrix of any numeric type. It provides ability to perform rotations, scaling, and translations. Results are cummulative, i.e. every rotate, scale, and translate call transforms the terms that already exist in the matrix. Call MakeIdentity() to start with an identity matrix, or Clear() to clear the matrix with all zeros.

Constructor & Destructor Documentation

◆ GlsMatrixAffine() [1/4]

Default constructor. The new matrix will be the identity matrix.

◆ GlsMatrixAffine() [2/4]

GlsMatrixAffine ( const Type  m[4][4])

Constructor.

Parameters
ma row-major, two-dimensional array used to initialize the matrix.

◆ GlsMatrixAffine() [3/4]

GlsMatrixAffine ( const Type *  m)

Constructor.

Parameters
ma column-major, one-dimensional array containing all values to initialize the matrix with.

◆ GlsMatrixAffine() [4/4]

GlsMatrixAffine ( const GlsMatrix< Type, 4 > &  m)

Copy Constructor.

Parameters
mbase class matrix to copy.

◆ ~GlsMatrixAffine()

Destructor.

Member Function Documentation

◆ IsVeryClose()

bool IsVeryClose ( const GlsMatrix< Type, 4 > &  b) const
inline
Returns
True if the supplied matrix is "very close" to this one.
Parameters
bThe matrix to compare.

◆ operator*() [1/2]

Vector operator* ( const Vector v) const
inline
Returns
A transformed vector using the specified vertex and the data in the matrix, e.g. w = M * v
Parameters
vThe vector to transform.

◆ operator*() [2/2]

Vertex operator* ( const Vertex v) const
inline
Returns
A transformed vertex using the specified vertex and the data in the matrix, e.g. w = M * v
Parameters
vThe vertex to transform.

◆ Rotate() [1/3]

void Rotate ( Type  angle,
const Vector centerOfRotation,
const Vector axis 
)

Perform a rotation transformation around an arbitrary axis using a specified center of rotation, and combine this transformation with the existing matrix data.

Parameters
anglerotation angle in degrees
centerOfRotationpoint to rotate around
axisarbitray axis of rotation

◆ Rotate() [2/3]

void Rotate ( Type  angle,
const Vector centerOfRotation,
RotationAxis  axis 
)

Perform a rotation transformation around a major axis using a specified center of rotation, and combine this transformation with the existing matrix data.

Parameters
anglerotation angle in degrees
centerOfRotationpoint to rotate around
axismajor axis of rotation: X_AXIS, Y_AXIS, Z_AXIS

◆ Rotate() [3/3]

void Rotate ( Type  angle,
RotationAxis  axis 
)

Perform a rotation transformation around a major axis around the origin, and combine this transformation with the existing matrix data.

Parameters
anglerotation angle in degrees
axismajor axis of rotation: X_AXIS, Y_AXIS, Z_AXIS

◆ Scale() [1/2]

void Scale ( Type  x,
Type  y,
Type  z 
)

Perform a scaling transformation using the origin as the anchor point, and combine this transformation with the existing matrix data.

Parameters
xscaling factor in the x direction. 1 = 100% (no scaling change)
yscaling factor in the y direction. 1 = 100% (no scaling change)
zscaling factor in the z direction. 1 = 100% (no scaling change)

◆ Scale() [2/2]

void Scale ( Type  x,
Type  y,
Type  z,
const Vector anchor 
)

Perform a scaling transformation using an arbitrary anchor point, and combine this transformation with the existing matrix data.

Parameters
xscaling factor in the x direction. 1 = 100% (no scaling change)
yscaling factor in the y direction. 1 = 100% (no scaling change)
zscaling factor in the z direction. 1 = 100% (no scaling change)
anchorThe anchor point for the scaling

◆ Transform()

void Transform ( Vector v) const
inline

Transform the specified vertex using the data in the matrix, where the 4th vector component is assumed to be a 1 (position) i.e. v = M * v

Parameters
vA modifiable reference to the vector to transform.

◆ Translate() [1/2]

void Translate ( const Vector v)
inline

Perform a translation, and combine this transformation with the existing matrix data.

Parameters
vcontaining the translate values

◆ Translate() [2/2]

void Translate ( Type  x,
Type  y,
Type  z 
)
inline

Perform a translation, and combine this transformation with the existing matrix data.

Parameters
xtranslation in the x direction
ytranslation in the y direction
ztranslation in the z direction

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