| GL Studio C++ Runtime API

Public Types | Public Member Functions | List of all members
GlsMatrixAffine< Type > Class Template Reference

`#include <gls_matrix_affine.h>`

Inheritance diagram for GlsMatrixAffine< Type >:

## 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]

GlsMatrixAffine

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

## ◆ GlsMatrixAffine() [2/4]

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

Constructor.

Parameters

  m | a row-major, two-dimensional array used to initialize the matrix.

## ◆ GlsMatrixAffine() [3/4]

GlsMatrixAffine | ( | const Type * | m | ) |

Constructor.

Parameters

  m | a 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

  m | base class matrix to copy.

## ◆ ~GlsMatrixAffine()

~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

  b | The 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

  v | The 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

  v | The 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

  angle | rotation angle in degrees
  centerOfRotation | point to rotate around
  axis | arbitray 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

  angle | rotation angle in degrees
  centerOfRotation | point to rotate around
  axis | major 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

  angle | rotation angle in degrees
  axis | major 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

  x | scaling factor in the x direction. 1 = 100% (no scaling change)
  y | scaling factor in the y direction. 1 = 100% (no scaling change)
  z | scaling 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

  x | scaling factor in the x direction. 1 = 100% (no scaling change)
  y | scaling factor in the y direction. 1 = 100% (no scaling change)
  z | scaling factor in the z direction. 1 = 100% (no scaling change)
  anchor | The 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

  v | A 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

  v | containing 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

  x | translation in the x direction
  y | translation in the y direction
  z | translation in the z direction

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

- gls_matrix_affine.h