Developer Documentation
ACG::SceneGraph::ACG::GLMatrixT< Scalar > Class Template Reference

4x4 matrix implementing OpenGL commands. More...

#include <OpenFlipper/libs_required/ACG/Scenegraph/MeshNode2T_impl.hh>

Inheritance diagram for ACG::SceneGraph::ACG::GLMatrixT< Scalar >:
ACG::SceneGraph::ACG::Matrix4x4T< 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
 
GLMatrixToperator+= (const Matrix4x4T< Scalar > &_rhs)
 
GLMatrixToperator-= (const Matrix4x4T< Scalar > &_rhs)
 
GLMatrixToperator*= (const Matrix4x4T< Scalar > &_rhs)
 
GLMatrixTleftMult (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::SceneGraph::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
 
Matrix4x4Toperator+= (const Matrix4x4T< Scalar > &_rhs)
 self += _rhs
 
Matrix4x4Toperator-= (const Matrix4x4T< Scalar > &_rhs)
 self -= _rhs
 
Matrix4x4Toperator*= (const Matrix4x4T< Scalar > &_rhs)
 self *= _rhs
 
Matrix4x4TleftMult (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::SceneGraph::ACG::Matrix4x4T< Scalar >
Scalar mat_ [16]
 

Detailed Description

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

4x4 matrix implementing OpenGL commands.

Definition at line 79 of file MeshNode2T_impl.hh.

Constructor & Destructor Documentation

◆ GLMatrixT() [1/2]

template<class Scalar>
ACG::SceneGraph::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 MeshNode2T_impl.hh.

◆ GLMatrixT() [2/2]

template<class Scalar>
ACG::SceneGraph::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 MeshNode2T_impl.hh.

Member Function Documentation

◆ lookAt()

template<class Scalar>
void ACG::SceneGraph::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)

◆ perspective()

template<class Scalar>
void ACG::SceneGraph::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
fovYHalf of the Field of View in y direction angle (Degree)
aspectaspect ratio: x = y * aspect
near_planeDistance to near plane ( > 0 )
far_planeDistance to far plane ( > near_plane > 0 )

◆ rotate() [1/2]

template<class Scalar>
void ACG::SceneGraph::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)

◆ rotate() [2/2]

template<class Scalar>
void ACG::SceneGraph::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 MeshNode2T_impl.hh.


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