Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

# 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 | 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 CMatrix4 & | operator+= (const CMatrix4 &m)
const CMatrix4 & | operator-= (const CMatrix4 &m)
CMatrix4 | operator * (const CMatrix4 &m) const
const CMatrix4 & | operator *= (const CMatrix4 &m)
const CMatrix4 & | operator *= (Real t)
const CMatrix4 & | operator/= (Real t)
bool | operator== (const CMatrix4 &m) const
bool | operator!= (const CMatrix4 &m) const
Real & | operator() (size_t i, size_t j)
| Indexed access operator.
const Real & | operator() (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 206 of file KeosMatrix4.h. Referenced by operator *(), operator+(), operator-(), and Transpose().

## Member Function Documentation

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

| Return the determinant.

Returns:
  Determinant value.

Definition at line 228 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().

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

| Get the translation transformation part of the matrix.

Returns:
  The translation vector.

Definition at line 370 of file KeosMatrix4.h.

References a14, a24, and a34.

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

| Identity matrix. Definition at line 219 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::Inverse | ( |  | ) | const`[inline]`

| Inverse the matrix.

Returns:
  Inversed matrix.

Definition at line 248 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::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 415 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 CMatrix4 & | m | ) | const`[inline]`

| Definition at line 487 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 *= | ( | Real | t | ) | `[inline]`

| Definition at line 519 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 511 of file KeosMatrix4.h.

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

| Cast in Real* operator. Definition at line 572 of file KeosMatrix4.h. References a11.

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

| Cast in Real* operator. Definition at line 578 of file KeosMatrix4.h. References a11. Referenced by operator()().

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

| Definition at line 554 of file KeosMatrix4.h.

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 566 of file KeosMatrix4.h.

References operator()().

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 560 of file KeosMatrix4.h.

References operator Real *().

Referenced by operator()().

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

| Definition at line 447 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`[inline]`

| Definition at line 432 of file KeosMatrix4.h.

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

| Definition at line 465 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 456 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`[inline]`

| Definition at line 438 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 476 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 530 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 541 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 393 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 402 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::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 334 of file KeosMatrix4.h.

References SetRotationX(), and SetTranslation().

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

| Build a rotation X matrix.

Parameters:

  | Angle | Rotation angle in radians.

Definition at line 298 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,
|  | 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 346 of file KeosMatrix4.h.

References SetRotationY(), and SetTranslation().

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

| Build a rotation Y matrix.

Parameters:

  | Angle | Rotation angle in radians.

Definition at line 310 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,
|  | 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 358 of file KeosMatrix4.h.

References SetRotationZ(), and SetTranslation().

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

| Build a rotation Z matrix.

Parameters:

  | Angle | Rotation angle in radians.

Definition at line 322 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::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 289 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::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 280 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(), and SetRotationZ().

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 384 of file KeosMatrix4.h.

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

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 376 of file KeosMatrix4.h.

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

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

| Transpose the matrix.

Returns:
  Transposed matrix.

Definition at line 239 of file KeosMatrix4.h.

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

## Member Data Documentation

Real Keos::CMatrix4::a11

| Definition at line 187 of file KeosMatrix4.h. Referenced by Determinant(), Identity(), Inverse(), LookAt(), operator *(), operator *=(), operator const Real *(), operator Real *(), operator+(), operator+=(), operator-(), operator-=(), operator/=(), Keos::operator<<(), operator==(), Keos::operator>>(), OrthoOffCenter(), PerspectiveFOV(), SetRotationX(), SetRotationY(), SetRotationZ(), SetScaling(), SetTranslation(), Transform(), and Transpose().

Real Keos::CMatrix4::a12

| Definition at line 188 of file KeosMatrix4.h. Referenced by Determinant(), Identity(), Inverse(), LookAt(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), operator/=(), Keos::operator<<(), operator==(), Keos::operator>>(), OrthoOffCenter(), PerspectiveFOV(), SetRotationX(), SetRotationY(), SetRotationZ(), SetScaling(), SetTranslation(), Transform(), and Transpose().

Real Keos::CMatrix4::a13

| Definition at line 189 of file KeosMatrix4.h. Referenced by Determinant(), Identity(), Inverse(), LookAt(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), operator/=(), Keos::operator<<(), operator==(), Keos::operator>>(), OrthoOffCenter(), PerspectiveFOV(), SetRotationX(), SetRotationY(), SetRotationZ(), SetScaling(), SetTranslation(), Transform(), and Transpose().

Real Keos::CMatrix4::a14

| Definition at line 190 of file KeosMatrix4.h. Referenced by Determinant(), GetTranslation(), Identity(), Inverse(), LookAt(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), operator/=(), Keos::operator<<(), operator==(), Keos::operator>>(), OrthoOffCenter(), PerspectiveFOV(), SetRotationX(), SetRotationY(), SetRotationZ(), SetScaling(), SetTranslation(), Transform(), and Transpose().

Real Keos::CMatrix4::a21

| Definition at line 187 of file KeosMatrix4.h. Referenced by Determinant(), Identity(), Inverse(), LookAt(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), operator/=(), Keos::operator<<(), operator==(), Keos::operator>>(), OrthoOffCenter(), PerspectiveFOV(), SetRotationX(), SetRotationY(), SetRotationZ(), SetScaling(), SetTranslation(), Transform(), and Transpose().

Real Keos::CMatrix4::a22

| Definition at line 188 of file KeosMatrix4.h. Referenced by Determinant(), Identity(), Inverse(), LookAt(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), operator/=(), Keos::operator<<(), operator==(), Keos::operator>>(), OrthoOffCenter(), PerspectiveFOV(), SetRotationX(), SetRotationY(), SetRotationZ(), SetScaling(), SetTranslation(), Transform(), and Transpose().

Real Keos::CMatrix4::a23

| Definition at line 189 of file KeosMatrix4.h. Referenced by Determinant(), Identity(), Inverse(), LookAt(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), operator/=(), Keos::operator<<(), operator==(), Keos::operator>>(), OrthoOffCenter(), PerspectiveFOV(), SetRotationX(), SetRotationY(), SetRotationZ(), SetScaling(), SetTranslation(), Transform(), and Transpose().

Real Keos::CMatrix4::a24

| Definition at line 190 of file KeosMatrix4.h. Referenced by Determinant(), GetTranslation(), Identity(), Inverse(), LookAt(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), operator/=(), Keos::operator<<(), operator==(), Keos::operator>>(), OrthoOffCenter(), PerspectiveFOV(), SetRotationX(), SetRotationY(), SetRotationZ(), SetScaling(), SetTranslation(), Transform(), and Transpose().

Real Keos::CMatrix4::a31

| Definition at line 187 of file KeosMatrix4.h. Referenced by Determinant(), Identity(), Inverse(), LookAt(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), operator/=(), Keos::operator<<(), operator==(), Keos::operator>>(), OrthoOffCenter(), PerspectiveFOV(), SetRotationX(), SetRotationY(), SetRotationZ(), SetScaling(), SetTranslation(), Transform(), and Transpose().

Real Keos::CMatrix4::a32

| Definition at line 188 of file KeosMatrix4.h. Referenced by Determinant(), Identity(), Inverse(), LookAt(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), operator/=(), Keos::operator<<(), operator==(), Keos::operator>>(), OrthoOffCenter(), PerspectiveFOV(), SetRotationX(), SetRotationY(), SetRotationZ(), SetScaling(), SetTranslation(), Transform(), and Transpose().

Real Keos::CMatrix4::a33

| Definition at line 189 of file KeosMatrix4.h. Referenced by Determinant(), Identity(), Inverse(), LookAt(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), operator/=(), Keos::operator<<(), operator==(), Keos::operator>>(), OrthoOffCenter(), PerspectiveFOV(), SetRotationX(), SetRotationY(), SetRotationZ(), SetScaling(), SetTranslation(), Transform(), and Transpose().

Real Keos::CMatrix4::a34

| Definition at line 190 of file KeosMatrix4.h. Referenced by Determinant(), GetTranslation(), Identity(), Inverse(), LookAt(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), operator/=(), Keos::operator<<(), operator==(), Keos::operator>>(), OrthoOffCenter(), PerspectiveFOV(), SetRotationX(), SetRotationY(), SetRotationZ(), SetScaling(), SetTranslation(), Transform(), and Transpose().

Real Keos::CMatrix4::a41

| Definition at line 187 of file KeosMatrix4.h. Referenced by Determinant(), Identity(), Inverse(), LookAt(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), operator/=(), Keos::operator<<(), operator==(), Keos::operator>>(), OrthoOffCenter(), PerspectiveFOV(), SetRotationX(), SetRotationY(), SetRotationZ(), SetScaling(), SetTranslation(), Transform(), and Transpose().

Real Keos::CMatrix4::a42

| Definition at line 188 of file KeosMatrix4.h. Referenced by Determinant(), Identity(), Inverse(), LookAt(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), operator/=(), Keos::operator<<(), operator==(), Keos::operator>>(), OrthoOffCenter(), PerspectiveFOV(), SetRotationX(), SetRotationY(), SetRotationZ(), SetScaling(), SetTranslation(), Transform(), and Transpose().

Real Keos::CMatrix4::a43

| Definition at line 189 of file KeosMatrix4.h. Referenced by Determinant(), Identity(), Inverse(), LookAt(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), operator/=(), Keos::operator<<(), operator==(), Keos::operator>>(), OrthoOffCenter(), PerspectiveFOV(), SetRotationX(), SetRotationY(), SetRotationZ(), SetScaling(), SetTranslation(), Transform(), and Transpose().

Real Keos::CMatrix4::a44

| Definition at line 190 of file KeosMatrix4.h. Referenced by Determinant(), Identity(), Inverse(), LookAt(), operator *(), operator *=(), operator+(), operator+=(), operator-(), 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:

- KeosEngine/KeosMatrix4.h