Keos::CMatrix4 Class Reference

Class encapsulating a standard 4x4 homogenous matrix. More...

#include <KeosMatrix4.h>

List of all members.

Public Member Functions

 CMatrix4 (Real m11=1.0f, Real m12=0.0f, Real m13=0.0f, Real m14=0.0f, Real m21=0.0f, Real m22=1.0f, Real m23=0.0f, Real m24=0.0f, Real m31=0.0f, Real m32=0.0f, Real m33=1.0f, Real m34=0.0f, Real m41=0.0f, Real m42=0.0f, Real m43=0.0f, Real m44=1.0f)
 Default constructor.
void Identity ()
 Identity matrix.
Real Determinant () const
 Return the determinant.
CMatrix4 Transpose () const
 Transpose the matrix.
CMatrix4 Inverse () const
 Inverse the matrix.
void SetTranslation (Real x, Real y, Real z)
 Build a translation matrix.
void SetTranslation (const TVector3F &Trans)
 Build a translation matrix.
void SetScaling (Real x, Real y, Real z)
 Build a scaling matrix.
void SetRotationX (Real Angle)
 Build a rotation X matrix.
void SetRotationY (Real Angle)
 Build a rotation Y matrix.
void SetRotationZ (Real Angle)
 Build a rotation Z matrix.
void SetRotationX (Real Angle, const TVector3F &Center)
 Built a rotation X matrix by specifying the center.
void SetRotationY (Real Angle, const TVector3F &Center)
 Built a rotation Y matrix by specifying the center.
void SetRotationZ (Real Angle, const TVector3F &Center)
 Built a rotation Z matrix by specifying the center.
TVector3F GetTranslation () const
 Get the translation transformation part of the matrix.
TVector3F Transform (const TVector3F &v, Real w=1.0f) const
 Transform a vector (3 reals).
TVector4F Transform (const TVector4F &v) const
 Transform a vector (4 reals).
void OrthoOffCenter (Real Left, Real Top, Real Right, Real Bottom)
 Build a ortho off center matrix.
void PerspectiveFOV (Real Fov, Real Ratio, Real Near, Real Far)
 Build a perspective projection matrix.
void LookAt (const TVector3F &From, const TVector3F &To, const TVector3F &Up=TVector3F(0, 1, 0))
 Build a view matrix.
CMatrix4 operator+ () const
CMatrix4 operator- () const
CMatrix4 operator+ (const CMatrix4 &m) const
CMatrix4 operator- (const CMatrix4 &m) const
const CMatrix4operator+= (const CMatrix4 &m)
const CMatrix4operator-= (const CMatrix4 &m)
CMatrix4 operator * (const CMatrix4 &m) const
const CMatrix4operator *= (const CMatrix4 &m)
const CMatrix4operator *= (Real t)
const CMatrix4operator/= (Real t)
bool operator== (const CMatrix4 &m) const
bool operator!= (const CMatrix4 &m) const
Realoperator() (size_t i, size_t j)
 Indexed access operator.
const Realoperator() (size_t i, size_t j) const
 Indexed access operator.
 operator Real * ()
 Cast in Real* operator.
 operator const Real * () const
 Cast in Real* operator.

Public Attributes

Real a11
Real a21
Real a31
Real a41
Real a12
Real a22
Real a32
Real a42
Real a13
Real a23
Real a33
Real a43
Real a14
Real a24
Real a34
Real a44


Detailed Description

Class encapsulating a standard 4x4 homogenous matrix.

Definition at line 33 of file KeosMatrix4.h.


Constructor & Destructor Documentation

Keos::CMatrix4::CMatrix4 ( Real  m11 = 1.0f,
Real  m12 = 0.0f,
Real  m13 = 0.0f,
Real  m14 = 0.0f,
Real  m21 = 0.0f,
Real  m22 = 1.0f,
Real  m23 = 0.0f,
Real  m24 = 0.0f,
Real  m31 = 0.0f,
Real  m32 = 0.0f,
Real  m33 = 1.0f,
Real  m34 = 0.0f,
Real  m41 = 0.0f,
Real  m42 = 0.0f,
Real  m43 = 0.0f,
Real  m44 = 1.0f 
) [inline]

Default constructor.

Definition at line 212 of file KeosMatrix4.h.

Referenced by operator *(), operator+(), operator-(), and Transpose().


Member Function Documentation

void Keos::CMatrix4::Identity (  )  [inline]

Identity matrix.

Definition at line 223 of file KeosMatrix4.h.

References a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34, a41, a42, a43, and a44.

Real Keos::CMatrix4::Determinant (  )  const [inline]

Return the determinant.

Returns:
Determinant value.

Definition at line 244 of file KeosMatrix4.h.

References a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34, a41, a42, a43, and a44.

Referenced by Inverse().

CMatrix4 Keos::CMatrix4::Transpose (  )  const [inline]

Transpose the matrix.

Returns:
Transposed matrix.

Definition at line 255 of file KeosMatrix4.h.

References a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34, a41, a42, a43, a44, and CMatrix4().

CMatrix4 Keos::CMatrix4::Inverse (  )  const [inline]

Inverse the matrix.

Returns:
Inversed matrix.

Definition at line 264 of file KeosMatrix4.h.

References a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34, a41, a42, a43, a44, and Determinant().

void Keos::CMatrix4::SetTranslation ( Real  x,
Real  y,
Real  z 
) [inline]

Build a translation matrix.

Parameters:
x X Translation.
y Y Translation.
z Z Translation.

Definition at line 296 of file KeosMatrix4.h.

References a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34, a41, a42, a43, and a44.

Referenced by SetRotationX(), SetRotationY(), SetRotationZ(), and SetTranslation().

void Keos::CMatrix4::SetTranslation ( const TVector3F Trans  )  [inline]

Build a translation matrix.

Parameters:
Trans Translation vector.

Definition at line 317 of file KeosMatrix4.h.

References SetTranslation(), Keos::CVector3< T >::x, Keos::CVector3< T >::y, and Keos::CVector3< T >::z.

void Keos::CMatrix4::SetScaling ( Real  x,
Real  y,
Real  z 
) [inline]

Build a scaling matrix.

Parameters:
x X Scaling.
y Y Scaling.
z Z Scaling.

Definition at line 323 of file KeosMatrix4.h.

References a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34, a41, a42, a43, and a44.

Referenced by Keos::Console::CLookDefault::CLookDefault(), and Keos::Console::CLookDefault::Update().

void Keos::CMatrix4::SetRotationX ( Real  Angle  )  [inline]

Build a rotation X matrix.

Parameters:
Angle Rotation angle in radians.

Definition at line 344 of file KeosMatrix4.h.

References a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34, a41, a42, a43, and a44.

Referenced by SetRotationX().

void Keos::CMatrix4::SetRotationY ( Real  Angle  )  [inline]

Build a rotation Y matrix.

Parameters:
Angle Rotation angle in radians.

Definition at line 368 of file KeosMatrix4.h.

References a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34, a41, a42, a43, and a44.

Referenced by SetRotationY().

void Keos::CMatrix4::SetRotationZ ( Real  Angle  )  [inline]

Build a rotation Z matrix.

Parameters:
Angle Rotation angle in radians.

Definition at line 392 of file KeosMatrix4.h.

References a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34, a41, a42, a43, and a44.

Referenced by SetRotationZ().

void Keos::CMatrix4::SetRotationX ( Real  Angle,
const TVector3F Center 
) [inline]

Built a rotation X matrix by specifying the center.

Parameters:
Angle Rotation angle in radians.
Center Rotation center.

Definition at line 416 of file KeosMatrix4.h.

References SetRotationX(), SetTranslation(), Keos::CVector3< T >::x, Keos::CVector3< T >::y, and Keos::CVector3< T >::z.

void Keos::CMatrix4::SetRotationY ( Real  Angle,
const TVector3F Center 
) [inline]

Built a rotation Y matrix by specifying the center.

Parameters:
Angle Rotation angle in radians.
Center Rotation center.

Definition at line 428 of file KeosMatrix4.h.

References SetRotationY(), SetTranslation(), Keos::CVector3< T >::x, Keos::CVector3< T >::y, and Keos::CVector3< T >::z.

void Keos::CMatrix4::SetRotationZ ( Real  Angle,
const TVector3F Center 
) [inline]

Built a rotation Z matrix by specifying the center.

Parameters:
Angle Rotation angle in radians.
Center Rotation center.

Definition at line 440 of file KeosMatrix4.h.

References SetRotationZ(), SetTranslation(), Keos::CVector3< T >::x, Keos::CVector3< T >::y, and Keos::CVector3< T >::z.

TVector3F Keos::CMatrix4::GetTranslation (  )  const [inline]

Get the translation transformation part of the matrix.

Returns:
The translation vector.

Definition at line 452 of file KeosMatrix4.h.

References a14, a24, and a34.

TVector3F Keos::CMatrix4::Transform ( const TVector3F v,
Real  w = 1.0f 
) const [inline]

Transform a vector (3 reals).

Parameters:
v Vector to be transformed.
w W element.
Returns:
The transformed vector.

Definition at line 458 of file KeosMatrix4.h.

References a11, a12, a13, a21, a22, a23, a31, a32, a33, a41, a42, and a43.

TVector4F Keos::CMatrix4::Transform ( const TVector4F v  )  const [inline]

Transform a vector (4 reals).

Parameters:
v Vector to be transformed.
Returns:
The transformed vector.

Definition at line 466 of file KeosMatrix4.h.

References a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34, a41, a42, a43, and a44.

void Keos::CMatrix4::OrthoOffCenter ( Real  Left,
Real  Top,
Real  Right,
Real  Bottom 
) [inline]

Build a ortho off center matrix.

Parameters:
Left Left
Top Top
Right Right
Bottom Bottom

Definition at line 475 of file KeosMatrix4.h.

References a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34, a41, a42, a43, and a44.

void Keos::CMatrix4::PerspectiveFOV ( Real  Fov,
Real  Ratio,
Real  Near,
Real  Far 
) [inline]

Build a perspective projection matrix.

Parameters:
Fov Field of vision.
Ratio Ratio width/height.
Near Value of near plan.
Far Value of far plan.

Definition at line 496 of file KeosMatrix4.h.

References a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34, a41, a42, a43, and a44.

void Keos::CMatrix4::LookAt ( const TVector3F From,
const TVector3F To,
const TVector3F Up = TVector3F(0, 1, 0) 
) [inline]

Build a view matrix.

Parameters:
From Camera position.
To Camera target.
Up Up vector ((0, 1, 0) by default).

Definition at line 534 of file KeosMatrix4.h.

References a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34, a41, a42, a43, a44, Keos::CVector3< T >::Normalize(), Keos::VectorCross(), Keos::VectorDot(), Keos::CVector3< T >::x, Keos::CVector3< T >::y, and Keos::CVector3< T >::z.

CMatrix4 Keos::CMatrix4::operator+ (  )  const [inline]

Definition at line 563 of file KeosMatrix4.h.

CMatrix4 Keos::CMatrix4::operator- (  )  const [inline]

Definition at line 569 of file KeosMatrix4.h.

References a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34, a41, a42, a43, a44, and CMatrix4().

CMatrix4 Keos::CMatrix4::operator+ ( const CMatrix4 m  )  const [inline]

Definition at line 578 of file KeosMatrix4.h.

References a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34, a41, a42, a43, a44, and CMatrix4().

CMatrix4 Keos::CMatrix4::operator- ( const CMatrix4 m  )  const [inline]

Definition at line 587 of file KeosMatrix4.h.

References a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34, a41, a42, a43, a44, and CMatrix4().

const CMatrix4 & Keos::CMatrix4::operator+= ( const CMatrix4 m  )  [inline]

Definition at line 596 of file KeosMatrix4.h.

References a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34, a41, a42, a43, and a44.

const CMatrix4 & Keos::CMatrix4::operator-= ( const CMatrix4 m  )  [inline]

Definition at line 619 of file KeosMatrix4.h.

References a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34, a41, a42, a43, and a44.

CMatrix4 Keos::CMatrix4::operator * ( const CMatrix4 m  )  const [inline]

Definition at line 642 of file KeosMatrix4.h.

References a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34, a41, a42, a43, a44, and CMatrix4().

const CMatrix4 & Keos::CMatrix4::operator *= ( const CMatrix4 m  )  [inline]

Definition at line 666 of file KeosMatrix4.h.

const CMatrix4 & Keos::CMatrix4::operator *= ( Real  t  )  [inline]

Definition at line 674 of file KeosMatrix4.h.

References a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34, a41, a42, a43, and a44.

const CMatrix4 & Keos::CMatrix4::operator/= ( Real  t  )  [inline]

Definition at line 697 of file KeosMatrix4.h.

References a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34, a41, a42, a43, and a44.

bool Keos::CMatrix4::operator== ( const CMatrix4 m  )  const [inline]

Definition at line 720 of file KeosMatrix4.h.

References a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34, a41, a42, a43, and a44.

bool Keos::CMatrix4::operator!= ( const CMatrix4 m  )  const [inline]

Definition at line 733 of file KeosMatrix4.h.

Real & Keos::CMatrix4::operator() ( size_t  i,
size_t  j 
) [inline]

Indexed access operator.

Parameters:
i Line
j column
Returns:
Reference on the element (i, j) of the matrix.

Definition at line 739 of file KeosMatrix4.h.

References operator Real *().

Referenced by operator()().

const Real & Keos::CMatrix4::operator() ( size_t  i,
size_t  j 
) const [inline]

Indexed access operator.

Parameters:
i Line
j column
Returns:
Reference on the element (i, j) of the matrix.

Definition at line 745 of file KeosMatrix4.h.

References operator()().

Keos::CMatrix4::operator Real * (  )  [inline]

Cast in Real* operator.

Definition at line 757 of file KeosMatrix4.h.

References a11.

Referenced by operator()().

Keos::CMatrix4::operator const Real * (  )  const [inline]

Cast in Real* operator.

Definition at line 751 of file KeosMatrix4.h.

References a11.


Member Data Documentation

Real Keos::CMatrix4::a11

Definition at line 193 of file KeosMatrix4.h.

Referenced by Determinant(), Identity(), Inverse(), LookAt(), Keos::operator *(), operator *(), operator *=(), operator const Real *(), operator Real *(), operator+(), operator+=(), operator-(), operator-=(), Keos::operator/(), operator/=(), Keos::operator<<(), operator==(), Keos::operator>>(), OrthoOffCenter(), PerspectiveFOV(), SetRotationX(), SetRotationY(), SetRotationZ(), SetScaling(), SetTranslation(), Transform(), and Transpose().

Real Keos::CMatrix4::a21

Definition at line 193 of file KeosMatrix4.h.

Referenced by Determinant(), Identity(), Inverse(), LookAt(), Keos::operator *(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), Keos::operator/(), operator/=(), Keos::operator<<(), operator==(), Keos::operator>>(), OrthoOffCenter(), PerspectiveFOV(), SetRotationX(), SetRotationY(), SetRotationZ(), SetScaling(), SetTranslation(), Transform(), and Transpose().

Real Keos::CMatrix4::a31

Definition at line 193 of file KeosMatrix4.h.

Referenced by Determinant(), Identity(), Inverse(), LookAt(), Keos::operator *(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), Keos::operator/(), operator/=(), Keos::operator<<(), operator==(), Keos::operator>>(), OrthoOffCenter(), PerspectiveFOV(), SetRotationX(), SetRotationY(), SetRotationZ(), SetScaling(), SetTranslation(), Transform(), and Transpose().

Real Keos::CMatrix4::a41

Definition at line 193 of file KeosMatrix4.h.

Referenced by Determinant(), Identity(), Inverse(), LookAt(), Keos::operator *(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), Keos::operator/(), operator/=(), Keos::operator<<(), operator==(), Keos::operator>>(), OrthoOffCenter(), PerspectiveFOV(), SetRotationX(), SetRotationY(), SetRotationZ(), SetScaling(), SetTranslation(), Transform(), and Transpose().

Real Keos::CMatrix4::a12

Definition at line 194 of file KeosMatrix4.h.

Referenced by Determinant(), Identity(), Inverse(), LookAt(), Keos::operator *(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), Keos::operator/(), operator/=(), Keos::operator<<(), operator==(), Keos::operator>>(), OrthoOffCenter(), PerspectiveFOV(), SetRotationX(), SetRotationY(), SetRotationZ(), SetScaling(), SetTranslation(), Transform(), and Transpose().

Real Keos::CMatrix4::a22

Definition at line 194 of file KeosMatrix4.h.

Referenced by Determinant(), Identity(), Inverse(), LookAt(), Keos::operator *(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), Keos::operator/(), operator/=(), Keos::operator<<(), operator==(), Keos::operator>>(), OrthoOffCenter(), PerspectiveFOV(), SetRotationX(), SetRotationY(), SetRotationZ(), SetScaling(), SetTranslation(), Transform(), and Transpose().

Real Keos::CMatrix4::a32

Definition at line 194 of file KeosMatrix4.h.

Referenced by Determinant(), Identity(), Inverse(), LookAt(), Keos::operator *(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), Keos::operator/(), operator/=(), Keos::operator<<(), operator==(), Keos::operator>>(), OrthoOffCenter(), PerspectiveFOV(), SetRotationX(), SetRotationY(), SetRotationZ(), SetScaling(), SetTranslation(), Transform(), and Transpose().

Real Keos::CMatrix4::a42

Definition at line 194 of file KeosMatrix4.h.

Referenced by Determinant(), Identity(), Inverse(), LookAt(), Keos::operator *(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), Keos::operator/(), operator/=(), Keos::operator<<(), operator==(), Keos::operator>>(), OrthoOffCenter(), PerspectiveFOV(), SetRotationX(), SetRotationY(), SetRotationZ(), SetScaling(), SetTranslation(), Transform(), and Transpose().

Real Keos::CMatrix4::a13

Definition at line 195 of file KeosMatrix4.h.

Referenced by Determinant(), Identity(), Inverse(), LookAt(), Keos::operator *(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), Keos::operator/(), operator/=(), Keos::operator<<(), operator==(), Keos::operator>>(), OrthoOffCenter(), PerspectiveFOV(), SetRotationX(), SetRotationY(), SetRotationZ(), SetScaling(), SetTranslation(), Transform(), and Transpose().

Real Keos::CMatrix4::a23

Definition at line 195 of file KeosMatrix4.h.

Referenced by Determinant(), Identity(), Inverse(), LookAt(), Keos::operator *(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), Keos::operator/(), operator/=(), Keos::operator<<(), operator==(), Keos::operator>>(), OrthoOffCenter(), PerspectiveFOV(), SetRotationX(), SetRotationY(), SetRotationZ(), SetScaling(), SetTranslation(), Transform(), and Transpose().

Real Keos::CMatrix4::a33

Definition at line 195 of file KeosMatrix4.h.

Referenced by Determinant(), Identity(), Inverse(), LookAt(), Keos::operator *(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), Keos::operator/(), operator/=(), Keos::operator<<(), operator==(), Keos::operator>>(), OrthoOffCenter(), PerspectiveFOV(), SetRotationX(), SetRotationY(), SetRotationZ(), SetScaling(), SetTranslation(), Transform(), and Transpose().

Real Keos::CMatrix4::a43

Definition at line 195 of file KeosMatrix4.h.

Referenced by Determinant(), Identity(), Inverse(), LookAt(), Keos::operator *(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), Keos::operator/(), operator/=(), Keos::operator<<(), operator==(), Keos::operator>>(), OrthoOffCenter(), PerspectiveFOV(), SetRotationX(), SetRotationY(), SetRotationZ(), SetScaling(), SetTranslation(), Transform(), and Transpose().

Real Keos::CMatrix4::a14

Definition at line 196 of file KeosMatrix4.h.

Referenced by Determinant(), GetTranslation(), Identity(), Inverse(), LookAt(), Keos::operator *(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), Keos::operator/(), operator/=(), Keos::operator<<(), operator==(), Keos::operator>>(), OrthoOffCenter(), PerspectiveFOV(), SetRotationX(), SetRotationY(), SetRotationZ(), SetScaling(), SetTranslation(), Transform(), and Transpose().

Real Keos::CMatrix4::a24

Definition at line 196 of file KeosMatrix4.h.

Referenced by Determinant(), GetTranslation(), Identity(), Inverse(), LookAt(), Keos::operator *(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), Keos::operator/(), operator/=(), Keos::operator<<(), operator==(), Keos::operator>>(), OrthoOffCenter(), PerspectiveFOV(), SetRotationX(), SetRotationY(), SetRotationZ(), SetScaling(), SetTranslation(), Transform(), and Transpose().

Real Keos::CMatrix4::a34

Definition at line 196 of file KeosMatrix4.h.

Referenced by Determinant(), GetTranslation(), Identity(), Inverse(), LookAt(), Keos::operator *(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), Keos::operator/(), operator/=(), Keos::operator<<(), operator==(), Keos::operator>>(), OrthoOffCenter(), PerspectiveFOV(), SetRotationX(), SetRotationY(), SetRotationZ(), SetScaling(), SetTranslation(), Transform(), and Transpose().

Real Keos::CMatrix4::a44

Definition at line 196 of file KeosMatrix4.h.

Referenced by Determinant(), Identity(), Inverse(), LookAt(), Keos::operator *(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), Keos::operator/(), operator/=(), Keos::operator<<(), operator==(), Keos::operator>>(), OrthoOffCenter(), PerspectiveFOV(), SetRotationX(), SetRotationY(), SetRotationZ(), SetScaling(), SetTranslation(), Transform(), and Transpose().


The documentation for this class was generated from the following file:
Generated on Fri Mar 9 14:29:25 2007 for Keos by  doxygen 1.5.1-p1