Developer Documentation

Public Types | Public Member Functions | Private Types | Private Member Functions | List of all members
ACG::GLMatrixT< Scalar > Class Template Reference

4x4 matrix implementing OpenGL commands. More...

`#include <OpenFlipper/libs_required/ACG/Math/GLMatrixT.hh>`

Inheritance diagram for ACG::GLMatrixT< Scalar >:

## Public Types
typedef VectorT< Scalar, 3 > | Vec3

## Public Member Functions
| GLMatrixT ()
| constructor: uninitialized values
template<class OtherScalar >
| GLMatrixT (const Matrix4x4T< OtherScalar > &_rhs)
| construct from other matrix type
| GLMatrixT (const GLMatrixT< Scalar > &_rhs)
| copy constructor
| GLMatrixT (const Scalar _array[16])
| GLMatrixT (const Vec3 &col1, const Vec3 &col2, const Vec3 &col3)
| ~GLMatrixT ()
| destructor
template<typename otherScalar >
GLMatrixT< Scalar > & | operator= (const GLMatrixT< otherScalar > &_rhs)
| assignement from other matrix type
template<typename otherScalar >
GLMatrixT< Scalar > & | operator= (const Matrix4x4T< otherScalar > &_rhs)
| assignement from other matrix type
void | scale (Scalar _x, Scalar _y, Scalar _z, MultiplyFrom _mult_from=MULT_FROM_RIGHT)
| multiply self with scaling matrix (x,y,z)
void | scale (const Vec3 &_v, MultiplyFrom _mult_from=MULT_FROM_RIGHT)
| multiply self with scaling matrix (x,y,z)
void | translate (Scalar _x, Scalar _y, Scalar _z, MultiplyFrom _mult_from=MULT_FROM_RIGHT)
| multiply self with translation matrix (x,y,z)
void | translate (const Vec3 &_v, MultiplyFrom _mult_from=MULT_FROM_RIGHT)
| multiply self with translation matrix (x,y,z)
void | rotate (Scalar angle, Scalar x, Scalar y, Scalar z, MultiplyFrom _mult_from=MULT_FROM_RIGHT)
void | rotate (Scalar _angle, const Vec3 &_axis, MultiplyFrom _mult_from=MULT_FROM_RIGHT)
void | rotateX (Scalar _angle, MultiplyFrom _mult_from=MULT_FROM_RIGHT)
| multiply self with a rotation matrix (angle in degree, x-axis)
void | rotateY (Scalar _angle, MultiplyFrom _mult_from=MULT_FROM_RIGHT)
| multiply self with a rotation matrix (angle in degree, y-axis)
void | rotateZ (Scalar _angle, MultiplyFrom _mult_from=MULT_FROM_RIGHT)
| multiply self with a rotation matrix (angle in degree, z-axis)
void | lookAt (const Vec3 &eye, const Vec3 &center, const Vec3 &up)
void | inverse_lookAt (const Vec3 &eye, const Vec3 &center, const Vec3 &up)
| multiply self from left with inverse lookAt matrix
void | perspective (Scalar fovY, Scalar aspect, Scalar near_plane, Scalar far_plane)
| multiply self with a perspective projection matrix More...
void | inverse_perspective (Scalar fovY, Scalar aspect, Scalar near_plane, Scalar far_plane)
| multiply self from left with inverse of perspective projection matrix
void | frustum (Scalar left, Scalar right, Scalar bottom, Scalar top, Scalar near_plane, Scalar far_plane)
| multiply self with a perspective projection matrix
void | inverse_frustum (Scalar left, Scalar right, Scalar bottom, Scalar top, Scalar near_plane, Scalar far_plane)
| multiply self from left with inverse of perspective projection matrix
void | ortho (Scalar left, Scalar right, Scalar bottom, Scalar top, Scalar near_plane, Scalar far_plane)
| multiply self with orthographic projection matrix
void | inverse_ortho (Scalar left, Scalar right, Scalar bottom, Scalar top, Scalar near_plane, Scalar far_plane)
| multiply self from left with inverse orthographic projection matrix
VectorT< Scalar, 2 > | extract_planes_perspective () const
| extract near and far clipping planes from a perspective projection matrix
VectorT< Scalar, 2 > | extract_planes_ortho () const
| extract near and far clipping planes from an orthographic projection matrix
bool | isPerspective () const
| check if the matrix is a perspective projection matrix
bool | isOrtho () const
| check if the matrix is an orthographic projection matrix
VectorT< Scalar, 2 > | extract_planes () const
| detect type of projection matrix and extract near and far clipping planes
GLMatrixT & | operator+= (const Matrix4x4T< Scalar > &_rhs)
GLMatrixT & | operator-= (const Matrix4x4T< Scalar > &_rhs)
GLMatrixT & | operator*= (const Matrix4x4T< Scalar > &_rhs)
GLMatrixT & | leftMult (const Matrix4x4T< Scalar > &_rhs)
GLMatrixT | operator+ (const Matrix4x4T< Scalar > &_rhs) const
GLMatrixT | operator- (const Matrix4x4T< Scalar > &_rhs) const
GLMatrixT | operator* (const Matrix4x4T< Scalar > &_rhs) const
template<typename T >
VectorT< T, 4 > | operator* (const VectorT< T, 4 > &_v) const
Public Member Functions inherited from ACG::Matrix4x4T< Scalar >
| Matrix4x4T ()
| constructor: uninitialized values
template<class OtherScalar >
| Matrix4x4T (const Matrix4x4T< OtherScalar > &_rhs)
| construct from other matrix type
| Matrix4x4T (const Scalar _array[16])
| ~Matrix4x4T ()
| destructor
template<typename otherScalar >
Matrix4x4T< Scalar > & | operator= (const Matrix4x4T< otherScalar > &_rhs)
| assignment from other matrix type
Scalar & | operator() (unsigned int row, unsigned int col)
| access operator (read and write)
const Scalar & | operator() (unsigned int row, unsigned int col) const
| access operator (read only)
bool | operator== (const Matrix4x4T< Scalar > &_rhs) const
| compare two matrices (up to some epsilon)
bool | operator!= (const Matrix4x4T< Scalar > &_rhs) const
| compare two matrices
Matrix4x4T | operator+ (Matrix4x4T< Scalar > _rhs) const
| self + _rhs
Matrix4x4T | operator- (Matrix4x4T< Scalar > _rhs) const
| self - _rhs
Matrix4x4T | operator* (const Matrix4x4T< Scalar > &inst) const
| self * _rhs
Matrix4x4T | operator* (const Scalar &scalar)
| self * scalar
Matrix4x4T & | operator+= (const Matrix4x4T< Scalar > &_rhs)
| self += _rhs
Matrix4x4T & | operator-= (const Matrix4x4T< Scalar > &_rhs)
| self -= _rhs
Matrix4x4T & | operator*= (const Matrix4x4T< Scalar > &_rhs)
| self *= _rhs
Matrix4x4T & | leftMult (const Matrix4x4T< Scalar > &_rhs)
| multiply from left: self = _rhs * self
template<typename T >
VectorT< T, 4 > | operator* (const VectorT< T, 4 > &_v) const
| matrix by vector multiplication
template<typename T >
VectorT< T, 3 > | transform_point (const VectorT< T, 3 > &_v) const
| transform point (x',y',z',1) = M * (x,y,z,1)
template<typename T >
VectorT< T, 3 > | transform_vector (const VectorT< T, 3 > &_v) const
| transform vector (x',y',z',0) = A * (x,y,z,0)
void | clear ()
| sets all elements to zero
void | identity ()
| setup an identity matrix
bool | is_identity () const
| check if the matrix is the identity ( up to an epsilon )
void | transpose ()
| transpose matrix
bool | invert ()
| matrix inversion (returns true on success)
Scalar | determinant () const
const Scalar * | get_raw_data () const
const Scalar * | raw () const
const Scalar * | data () const

## Private Types
enum | Axis { X, Y, Z }

## Private Member Functions
void | rotateXYZ (Axis _axis, Scalar _angle, MultiplyFrom _mult_from)

## Additional Inherited Members
Protected Attributes inherited from ACG::Matrix4x4T< Scalar >
Scalar | mat_ [16]

## Detailed Description

### template<class Scalar>
class ACG::GLMatrixT< Scalar >

4x4 matrix implementing OpenGL commands.

Definition at line 79 of file GLMatrixT.hh.

## Constructor & Destructor Documentation

## ◆ GLMatrixT() [1/2]

template<class Scalar>

ACG::GLMatrixT< Scalar >::GLMatrixT | ( | const Scalar | _array[16] | ) |
| inline

setup matrix using an array of N*N scalar values. elements are ordered 'column first' (like OpenGL)

Definition at line 102 of file GLMatrixT.hh.

## ◆ GLMatrixT() [2/2]

template<class Scalar>

ACG::GLMatrixT< Scalar >::GLMatrixT | ( | const Vec3 & | col1,
|  | const Vec3 & | col2,
|  | const Vec3 & | col3
| ) |  |
| inline

Initialize an affine matrix from column vectors.

Definition at line 107 of file GLMatrixT.hh.

## Member Function Documentation

## ◆ lookAt()

template<typename Scalar >

void ACG::GLMatrixT< Scalar >::lookAt | ( | const Vec3 & | eye,
|  | const Vec3 & | center,
|  | const Vec3 & | up
| ) |  |

multiply self with a viewing transformation given by eye position, reference point (center) and an up vector. (similar to gluLookAt)

Definition at line 216 of file GLMatrixT_impl.hh.

## ◆ perspective()

template<typename Scalar>

void ACG::GLMatrixT< Scalar >::perspective | ( | Scalar | fovY,
|  | Scalar | aspect,
|  | Scalar | near_plane,
|  | Scalar | far_plane
| ) |  |

multiply self with a perspective projection matrix

The specified perspective projection will be multiplied with the matrix already stored in this matix.

Parameters

  fovY | Half of the Field of View in y direction angle (Degree)
  aspect | aspect ratio: x = y * aspect
  near_plane | Distance to near plane ( > 0 )
  far_plane | Distance to far plane ( > near_plane > 0 )

Definition at line 277 of file GLMatrixT_impl.hh.

## ◆ rotate() [1/2]

template<typename Scalar>

void ACG::GLMatrixT< Scalar >::rotate | ( | Scalar | angle,
|  | Scalar | x,
|  | Scalar | y,
|  | Scalar | z,
|  | MultiplyFrom | _mult_from = `MULT_FROM_RIGHT`
| ) |  |

multiply self with a rotation matrix (angle in degree, arbitrary axis given by xyz)

Definition at line 155 of file GLMatrixT_impl.hh.

## ◆ rotate() [2/2]

template<class Scalar>

void ACG::GLMatrixT< Scalar >::rotate | ( | Scalar | _angle,
|  | const Vec3 & | _axis,
|  | MultiplyFrom | _mult_from = `MULT_FROM_RIGHT`
| ) |  |
| inline

multiply self with a rotation matrix (angle in degree, arbitrary axis given by xyz)

Definition at line 184 of file GLMatrixT.hh.

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

- OpenFlipper/libs_required/ACG/Math/GLMatrixT.hh
- OpenFlipper/libs_required/ACG/Math/GLMatrixT_impl.hh