Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics
[Home] [Tutorials] [All Classes] [Grouped Classes]
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes

vl::Matrix4< T_scalar_type > Class Template Reference

The Matrix4 class is a template class that implements a generic 4x4 matrix, see also vl::dmat4, vl::fmat4, vl::umat4, vl::imat4. More...

#include <Matrix4.hpp>

List of all members.

Public Types

typedef T_scalar_type scalar_type

Public Member Functions

template<typename T >
 Matrix4 (const T &m)
 Matrix4 ()
 Matrix4 (T_scalar_type n)
 Matrix4 (T_scalar_type e00, T_scalar_type e01, T_scalar_type e02, T_scalar_type e03, T_scalar_type e10, T_scalar_type e11, T_scalar_type e12, T_scalar_type e13, T_scalar_type e20, T_scalar_type e21, T_scalar_type e22, T_scalar_type e23, T_scalar_type e30, T_scalar_type e31, T_scalar_type e32, T_scalar_type e33)
Matrix4fill (T_scalar_type val)
T_scalar_type diff (const Matrix4 &other)
const T_scalar_type & e (unsigned i, unsigned j) const
T_scalar_type & e (unsigned i, unsigned j)
const Vector4< T_scalar_type > & operator[] (unsigned int i) const
Vector4< T_scalar_type > & operator[] (unsigned int i)
Vector3< T_scalar_type > getX () const
Vector3< T_scalar_type > getY () const
Vector3< T_scalar_type > getZ () const
Vector3< T_scalar_type > getT () const
Matrix4setX (const Vector3< T_scalar_type > &v)
Matrix4setY (const Vector3< T_scalar_type > &v)
Matrix4setZ (const Vector3< T_scalar_type > &v)
Matrix4setT (const Vector3< T_scalar_type > &v)
bool operator== (const Matrix4 &m) const
bool operator!= (const Matrix4 &m) const
Matrix4operator= (const Matrix4 &m)
Matrix4 operator+ (const Matrix4 &m) const
Matrix4operator+= (const Matrix4 &m)
Matrix4 operator- (const Matrix4 &m) const
Matrix4operator-= (const Matrix4 &m)
Matrix4operator*= (const Matrix4 &m)
Matrix4 operator- () const
Matrix4 operator+ (T_scalar_type d) const
Matrix4operator+= (T_scalar_type d)
Matrix4 operator- (T_scalar_type d) const
Matrix4operator-= (T_scalar_type d)
Matrix4 operator* (T_scalar_type d) const
Matrix4operator*= (T_scalar_type d)
Matrix4 operator/ (T_scalar_type d) const
Matrix4operator/= (T_scalar_type d)
bool isIdentity () const
Matrix4 as3x3 () const
Matrix3< T_scalar_type > get3x3 () const
void set3x3 (const Matrix3< T_scalar_type > &m)
 This writes only on the upper 3x3 part of the matrix without touching the last row and column.
T_scalar_type * ptr ()
const T_scalar_type * ptr () const
Matrix4transpose ()
Matrix4 getTransposed () const
void getTransposed (Matrix4 &dest) const
bool isNull () const
void setIdentity ()
T_scalar_type getInverse (Matrix4 &dest) const
Matrix4 getInverse (T_scalar_type *determinant=NULL) const
Matrix4invert (T_scalar_type *determinant=NULL)
const T_scalar_type & e (int i, int j) const
T_scalar_type & e (int i, int j)
void getAsLookAt (Vector3< T_scalar_type > &eye, Vector3< T_scalar_type > &look, Vector3< T_scalar_type > &up, Vector3< T_scalar_type > &right) const
Matrix4rotate (T_scalar_type degrees, const Vector3< T_scalar_type > &v)
Matrix4rotate (T_scalar_type degrees, T_scalar_type x, T_scalar_type y, T_scalar_type z)
Matrix4rotate (T_scalar_type degrees1, const Vector3< T_scalar_type > &v1, T_scalar_type degrees2, const Vector3< T_scalar_type > &v2)
void getYXRotationAngles (T_scalar_type &degrees_y, T_scalar_type &degrees_x) const
 If this matrix can be represented as RY(degrees_y) * RX(degrees_x), where RX and RY are rotation matrices around the X and Y axis respectively, this function returns the rotation angles degrees_y and degrees_x.
Matrix4rotate (T_scalar_type degrees1, const Vector3< T_scalar_type > &v1, T_scalar_type degrees2, const Vector3< T_scalar_type > &v2, T_scalar_type degrees3, const Vector3< T_scalar_type > &v3)
Matrix4rotateXYZ (T_scalar_type degX, T_scalar_type degY, T_scalar_type degZ)
Matrix4rotateZYX (T_scalar_type degZ, T_scalar_type degY, T_scalar_type degX)
Matrix4rotate (const Vector4< T_scalar_type > &from, const Vector4< T_scalar_type > &to)
Matrix4rotate (const Vector3< T_scalar_type > &from, const Vector3< T_scalar_type > &to)
Matrix4translate (T_scalar_type x, T_scalar_type y, T_scalar_type z)
Matrix4translate (const Vector3< T_scalar_type > &v)
Matrix4scale (T_scalar_type x, T_scalar_type y, T_scalar_type z)

Static Public Member Functions

static Matrix4 perspective (T_scalar_type fovy, T_scalar_type aspect_ratio, T_scalar_type znear, T_scalar_type zfar)
static Matrix4 frustum (T_scalar_type pleft, T_scalar_type pright, T_scalar_type pbottom, T_scalar_type ptop, T_scalar_type pnear, T_scalar_type pfar)
static Matrix4 ortho (T_scalar_type pleft, T_scalar_type pright, T_scalar_type pbottom, T_scalar_type ptop, T_scalar_type pnear, T_scalar_type pfar)
static Matrix4 ortho2D (T_scalar_type pleft, T_scalar_type pright, T_scalar_type pbottom, T_scalar_type ptop)
static Matrix4 lookAt (const Vector3< T_scalar_type > &eye, const Vector3< T_scalar_type > &look, const Vector3< T_scalar_type > &up)
static Matrix4 rotation (T_scalar_type degrees, T_scalar_type x, T_scalar_type y, T_scalar_type z)
static Matrix4 rotation (T_scalar_type degrees, const Vector3< T_scalar_type > &v)
static Matrix4 rotation (T_scalar_type degrees1, const Vector3< T_scalar_type > &v1, T_scalar_type degrees2, const Vector3< T_scalar_type > &v2)
static Matrix4 rotation (T_scalar_type degrees1, const Vector3< T_scalar_type > &v1, T_scalar_type degrees2, const Vector3< T_scalar_type > &v2, T_scalar_type degrees3, const Vector3< T_scalar_type > &v3)
static Matrix4 rotationXYZ (T_scalar_type degX, T_scalar_type degY, T_scalar_type degZ)
static Matrix4 rotationZYX (T_scalar_type degZ, T_scalar_type degY, T_scalar_type degX)
static Matrix4 rotation (const Vector4< T_scalar_type > &from, const Vector4< T_scalar_type > &to)
static Matrix4 rotation (const Vector3< T_scalar_type > &from, const Vector3< T_scalar_type > &to)
static Matrix4 translation (const Vector3< T_scalar_type > &v)
static Matrix4 translation (T_scalar_type x, T_scalar_type y, T_scalar_type z)
static Matrix4 scaling (const Vector3< T_scalar_type > &v)
static Matrix4 scaling (T_scalar_type x, T_scalar_type y, T_scalar_type z)

Protected Attributes

Vector4< T_scalar_type > mVec [4]

Detailed Description

template<typename T_scalar_type>
class vl::Matrix4< T_scalar_type >

The Matrix4 class is a template class that implements a generic 4x4 matrix, see also vl::dmat4, vl::fmat4, vl::umat4, vl::imat4.

See also:
Vector4, Vector3, Vector2, Matrix3, Matrix2

Member Typedef Documentation

template<typename T_scalar_type>
typedef T_scalar_type vl::Matrix4< T_scalar_type >::scalar_type

Constructor & Destructor Documentation

template<typename T_scalar_type>
template<typename T >
vl::Matrix4< T_scalar_type >::Matrix4 ( const T &  m ) [inline, explicit]
template<typename T_scalar_type>
vl::Matrix4< T_scalar_type >::Matrix4 (  ) [inline]
template<typename T_scalar_type>
vl::Matrix4< T_scalar_type >::Matrix4 ( T_scalar_type  n ) [inline]
template<typename T_scalar_type>
vl::Matrix4< T_scalar_type >::Matrix4 ( T_scalar_type  e00,
T_scalar_type  e01,
T_scalar_type  e02,
T_scalar_type  e03,
T_scalar_type  e10,
T_scalar_type  e11,
T_scalar_type  e12,
T_scalar_type  e13,
T_scalar_type  e20,
T_scalar_type  e21,
T_scalar_type  e22,
T_scalar_type  e23,
T_scalar_type  e30,
T_scalar_type  e31,
T_scalar_type  e32,
T_scalar_type  e33 
) [inline, explicit]

Member Function Documentation

template<typename T_scalar_type>
Matrix4& vl::Matrix4< T_scalar_type >::fill ( T_scalar_type  val ) [inline]
template<typename T_scalar_type>
T_scalar_type vl::Matrix4< T_scalar_type >::diff ( const Matrix4< T_scalar_type > &  other ) [inline]
template<typename T_scalar_type>
const T_scalar_type& vl::Matrix4< T_scalar_type >::e ( unsigned  i,
unsigned  j 
) const [inline]
template<typename T_scalar_type>
T_scalar_type& vl::Matrix4< T_scalar_type >::e ( unsigned  i,
unsigned  j 
) [inline]
template<typename T_scalar_type>
const Vector4<T_scalar_type>& vl::Matrix4< T_scalar_type >::operator[] ( unsigned int  i ) const [inline]
template<typename T_scalar_type>
Vector4<T_scalar_type>& vl::Matrix4< T_scalar_type >::operator[] ( unsigned int  i ) [inline]
template<typename T_scalar_type>
Vector3<T_scalar_type> vl::Matrix4< T_scalar_type >::getX (  ) const [inline]
template<typename T_scalar_type>
Vector3<T_scalar_type> vl::Matrix4< T_scalar_type >::getY (  ) const [inline]
template<typename T_scalar_type>
Vector3<T_scalar_type> vl::Matrix4< T_scalar_type >::getZ (  ) const [inline]
template<typename T_scalar_type>
Vector3<T_scalar_type> vl::Matrix4< T_scalar_type >::getT (  ) const [inline]
template<typename T_scalar_type>
Matrix4& vl::Matrix4< T_scalar_type >::setX ( const Vector3< T_scalar_type > &  v ) [inline]
template<typename T_scalar_type>
Matrix4& vl::Matrix4< T_scalar_type >::setY ( const Vector3< T_scalar_type > &  v ) [inline]
template<typename T_scalar_type>
Matrix4& vl::Matrix4< T_scalar_type >::setZ ( const Vector3< T_scalar_type > &  v ) [inline]
template<typename T_scalar_type>
Matrix4& vl::Matrix4< T_scalar_type >::setT ( const Vector3< T_scalar_type > &  v ) [inline]
template<typename T_scalar_type>
bool vl::Matrix4< T_scalar_type >::operator== ( const Matrix4< T_scalar_type > &  m ) const [inline]
template<typename T_scalar_type>
bool vl::Matrix4< T_scalar_type >::operator!= ( const Matrix4< T_scalar_type > &  m ) const [inline]
template<typename T_scalar_type>
Matrix4& vl::Matrix4< T_scalar_type >::operator= ( const Matrix4< T_scalar_type > &  m ) [inline]
template<typename T_scalar_type>
Matrix4 vl::Matrix4< T_scalar_type >::operator+ ( const Matrix4< T_scalar_type > &  m ) const [inline]
template<typename T_scalar_type>
Matrix4& vl::Matrix4< T_scalar_type >::operator+= ( const Matrix4< T_scalar_type > &  m ) [inline]
template<typename T_scalar_type>
Matrix4 vl::Matrix4< T_scalar_type >::operator- ( const Matrix4< T_scalar_type > &  m ) const [inline]
template<typename T_scalar_type>
Matrix4& vl::Matrix4< T_scalar_type >::operator-= ( const Matrix4< T_scalar_type > &  m ) [inline]
template<typename T_scalar_type>
Matrix4& vl::Matrix4< T_scalar_type >::operator*= ( const Matrix4< T_scalar_type > &  m ) [inline]
template<typename T_scalar_type>
Matrix4 vl::Matrix4< T_scalar_type >::operator- (  ) const [inline]
template<typename T_scalar_type>
Matrix4 vl::Matrix4< T_scalar_type >::operator+ ( T_scalar_type  d ) const [inline]
template<typename T_scalar_type>
Matrix4& vl::Matrix4< T_scalar_type >::operator+= ( T_scalar_type  d ) [inline]
template<typename T_scalar_type>
Matrix4 vl::Matrix4< T_scalar_type >::operator- ( T_scalar_type  d ) const [inline]
template<typename T_scalar_type>
Matrix4& vl::Matrix4< T_scalar_type >::operator-= ( T_scalar_type  d ) [inline]
template<typename T_scalar_type>
Matrix4 vl::Matrix4< T_scalar_type >::operator* ( T_scalar_type  d ) const [inline]
template<typename T_scalar_type>
Matrix4& vl::Matrix4< T_scalar_type >::operator*= ( T_scalar_type  d ) [inline]
template<typename T_scalar_type>
Matrix4 vl::Matrix4< T_scalar_type >::operator/ ( T_scalar_type  d ) const [inline]
template<typename T_scalar_type>
Matrix4& vl::Matrix4< T_scalar_type >::operator/= ( T_scalar_type  d ) [inline]
template<typename T_scalar_type>
bool vl::Matrix4< T_scalar_type >::isIdentity (  ) const [inline]
template<typename T_scalar_type>
Matrix4 vl::Matrix4< T_scalar_type >::as3x3 (  ) const [inline]
template<typename T_scalar_type>
Matrix3<T_scalar_type> vl::Matrix4< T_scalar_type >::get3x3 (  ) const [inline]
template<typename T_scalar_type>
void vl::Matrix4< T_scalar_type >::set3x3 ( const Matrix3< T_scalar_type > &  m ) [inline]

This writes only on the upper 3x3 part of the matrix without touching the last row and column.

template<typename T_scalar_type>
T_scalar_type* vl::Matrix4< T_scalar_type >::ptr (  ) [inline]
template<typename T_scalar_type>
const T_scalar_type* vl::Matrix4< T_scalar_type >::ptr (  ) const [inline]
template<typename T_scalar_type>
Matrix4& vl::Matrix4< T_scalar_type >::transpose (  ) [inline]
template<typename T_scalar_type>
Matrix4 vl::Matrix4< T_scalar_type >::getTransposed (  ) const [inline]
template<typename T_scalar_type>
void vl::Matrix4< T_scalar_type >::getTransposed ( Matrix4< T_scalar_type > &  dest ) const [inline]
template<typename T_scalar_type>
bool vl::Matrix4< T_scalar_type >::isNull (  ) const [inline]
template<typename T_scalar_type>
void vl::Matrix4< T_scalar_type >::setIdentity (  ) [inline]
template<typename T_scalar_type >
T_scalar_type vl::Matrix4< T_scalar_type >::getInverse ( Matrix4< T_scalar_type > &  dest ) const
template<typename T_scalar_type>
Matrix4 vl::Matrix4< T_scalar_type >::getInverse ( T_scalar_type *  determinant = NULL ) const [inline]
template<typename T_scalar_type>
Matrix4& vl::Matrix4< T_scalar_type >::invert ( T_scalar_type *  determinant = NULL ) [inline]
template<typename T_scalar_type>
const T_scalar_type& vl::Matrix4< T_scalar_type >::e ( int  i,
int  j 
) const [inline]
template<typename T_scalar_type>
T_scalar_type& vl::Matrix4< T_scalar_type >::e ( int  i,
int  j 
) [inline]
template<typename T_scalar_type>
Matrix4< T_scalar_type > vl::Matrix4< T_scalar_type >::perspective ( T_scalar_type  fovy,
T_scalar_type  aspect_ratio,
T_scalar_type  znear,
T_scalar_type  zfar 
) [static]
template<typename T_scalar_type>
Matrix4< T_scalar_type > vl::Matrix4< T_scalar_type >::frustum ( T_scalar_type  pleft,
T_scalar_type  pright,
T_scalar_type  pbottom,
T_scalar_type  ptop,
T_scalar_type  pnear,
T_scalar_type  pfar 
) [static]
template<typename T_scalar_type>
Matrix4< T_scalar_type > vl::Matrix4< T_scalar_type >::ortho ( T_scalar_type  pleft,
T_scalar_type  pright,
T_scalar_type  pbottom,
T_scalar_type  ptop,
T_scalar_type  pnear,
T_scalar_type  pfar 
) [static]
template<typename T_scalar_type>
Matrix4< T_scalar_type > vl::Matrix4< T_scalar_type >::ortho2D ( T_scalar_type  pleft,
T_scalar_type  pright,
T_scalar_type  pbottom,
T_scalar_type  ptop 
) [static]
template<typename T_scalar_type>
Matrix4< T_scalar_type > vl::Matrix4< T_scalar_type >::lookAt ( const Vector3< T_scalar_type > &  eye,
const Vector3< T_scalar_type > &  look,
const Vector3< T_scalar_type > &  up 
) [static]
template<typename T_scalar_type>
void vl::Matrix4< T_scalar_type >::getAsLookAt ( Vector3< T_scalar_type > &  eye,
Vector3< T_scalar_type > &  look,
Vector3< T_scalar_type > &  up,
Vector3< T_scalar_type > &  right 
) const
template<typename T_scalar_type>
Matrix4< T_scalar_type > vl::Matrix4< T_scalar_type >::rotation ( T_scalar_type  degrees,
T_scalar_type  x,
T_scalar_type  y,
T_scalar_type  z 
) [static]
template<typename T_scalar_type>
static Matrix4 vl::Matrix4< T_scalar_type >::rotation ( T_scalar_type  degrees,
const Vector3< T_scalar_type > &  v 
) [inline, static]
template<typename T_scalar_type>
static Matrix4 vl::Matrix4< T_scalar_type >::rotation ( T_scalar_type  degrees1,
const Vector3< T_scalar_type > &  v1,
T_scalar_type  degrees2,
const Vector3< T_scalar_type > &  v2 
) [inline, static]
template<typename T_scalar_type>
static Matrix4 vl::Matrix4< T_scalar_type >::rotation ( T_scalar_type  degrees1,
const Vector3< T_scalar_type > &  v1,
T_scalar_type  degrees2,
const Vector3< T_scalar_type > &  v2,
T_scalar_type  degrees3,
const Vector3< T_scalar_type > &  v3 
) [inline, static]
template<typename T_scalar_type>
Matrix4& vl::Matrix4< T_scalar_type >::rotate ( T_scalar_type  degrees,
const Vector3< T_scalar_type > &  v 
) [inline]
template<typename T_scalar_type>
Matrix4& vl::Matrix4< T_scalar_type >::rotate ( T_scalar_type  degrees,
T_scalar_type  x,
T_scalar_type  y,
T_scalar_type  z 
) [inline]
template<typename T_scalar_type>
Matrix4& vl::Matrix4< T_scalar_type >::rotate ( T_scalar_type  degrees1,
const Vector3< T_scalar_type > &  v1,
T_scalar_type  degrees2,
const Vector3< T_scalar_type > &  v2 
) [inline]
template<typename T_scalar_type>
void vl::Matrix4< T_scalar_type >::getYXRotationAngles ( T_scalar_type &  degrees_y,
T_scalar_type &  degrees_x 
) const

If this matrix can be represented as RY(degrees_y) * RX(degrees_x), where RX and RY are rotation matrices around the X and Y axis respectively, this function returns the rotation angles degrees_y and degrees_x.

Note:
This function can only retrieve angles that satisfy the following conditions:
  • -180 <= degrees_y <= 180
  • -180 <= degrees_x <= 180 and degrees_x != 90
template<typename T_scalar_type>
Matrix4& vl::Matrix4< T_scalar_type >::rotate ( T_scalar_type  degrees1,
const Vector3< T_scalar_type > &  v1,
T_scalar_type  degrees2,
const Vector3< T_scalar_type > &  v2,
T_scalar_type  degrees3,
const Vector3< T_scalar_type > &  v3 
) [inline]
template<typename T_scalar_type>
static Matrix4 vl::Matrix4< T_scalar_type >::rotationXYZ ( T_scalar_type  degX,
T_scalar_type  degY,
T_scalar_type  degZ 
) [inline, static]
template<typename T_scalar_type>
Matrix4& vl::Matrix4< T_scalar_type >::rotateXYZ ( T_scalar_type  degX,
T_scalar_type  degY,
T_scalar_type  degZ 
) [inline]
template<typename T_scalar_type>
static Matrix4 vl::Matrix4< T_scalar_type >::rotationZYX ( T_scalar_type  degZ,
T_scalar_type  degY,
T_scalar_type  degX 
) [inline, static]
template<typename T_scalar_type>
Matrix4& vl::Matrix4< T_scalar_type >::rotateZYX ( T_scalar_type  degZ,
T_scalar_type  degY,
T_scalar_type  degX 
) [inline]
template<typename T_scalar_type>
static Matrix4 vl::Matrix4< T_scalar_type >::rotation ( const Vector4< T_scalar_type > &  from,
const Vector4< T_scalar_type > &  to 
) [inline, static]
template<typename T_scalar_type>
Matrix4< T_scalar_type > vl::Matrix4< T_scalar_type >::rotation ( const Vector3< T_scalar_type > &  from,
const Vector3< T_scalar_type > &  to 
) [static]
template<typename T_scalar_type>
Matrix4& vl::Matrix4< T_scalar_type >::rotate ( const Vector4< T_scalar_type > &  from,
const Vector4< T_scalar_type > &  to 
) [inline]
template<typename T_scalar_type>
Matrix4& vl::Matrix4< T_scalar_type >::rotate ( const Vector3< T_scalar_type > &  from,
const Vector3< T_scalar_type > &  to 
) [inline]
template<typename T_scalar_type>
static Matrix4 vl::Matrix4< T_scalar_type >::translation ( const Vector3< T_scalar_type > &  v ) [inline, static]
template<typename T_scalar_type>
static Matrix4 vl::Matrix4< T_scalar_type >::translation ( T_scalar_type  x,
T_scalar_type  y,
T_scalar_type  z 
) [inline, static]
template<typename T_scalar_type>
Matrix4& vl::Matrix4< T_scalar_type >::translate ( T_scalar_type  x,
T_scalar_type  y,
T_scalar_type  z 
) [inline]
template<typename T_scalar_type>
Matrix4& vl::Matrix4< T_scalar_type >::translate ( const Vector3< T_scalar_type > &  v ) [inline]
template<typename T_scalar_type>
static Matrix4 vl::Matrix4< T_scalar_type >::scaling ( const Vector3< T_scalar_type > &  v ) [inline, static]
template<typename T_scalar_type>
static Matrix4 vl::Matrix4< T_scalar_type >::scaling ( T_scalar_type  x,
T_scalar_type  y,
T_scalar_type  z 
) [inline, static]
template<typename T_scalar_type>
Matrix4& vl::Matrix4< T_scalar_type >::scale ( T_scalar_type  x,
T_scalar_type  y,
T_scalar_type  z 
) [inline]

Member Data Documentation

template<typename T_scalar_type>
Vector4<T_scalar_type> vl::Matrix4< T_scalar_type >::mVec[4] [protected]

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

Visualization Library v2010.11.1125 Reference Documentation
Copyright 2005-2009 Michele Bosi. All rights reserved.
Updated on Fri Nov 26 2010 10:33:47.
Permission is granted to use this page to write and publish articles regarding Visualization Library.