- Main Page
- Modules
- Classes
- Files
- Related Pages

- Class List
- Class Hierarchy
- Class Members

# Matrix4< T > Class Template Reference

`#include <vmath.h>`

List of all members.

## Public Member Functions
| Matrix4 ()
| Matrix4 (const T *dt)
| Matrix4 (const Matrix4< T > &src)
template<class FromT>
| Matrix4 (const Matrix4< FromT > &src)
void | identity ()
bool | operator== (const Matrix4< T > &rhs) const
bool | operator!= (const Matrix4< T > &rhs) const
T & | at (int x, int y)
const T & | at (int x, int y) const
void | setTranslation (const Vector3< T > &v)
Vector3< T > | getTranslation ()
void | setRotation (const Matrix3< T > &m)
Matrix4< T > & | operator= (const Matrix4< T > &rhs)
template<class FromT>
Matrix4< T > & | operator= (const Matrix4< FromT > &rhs)
Matrix4< T > & | operator= (const T *rhs)
Matrix4< T > | operator+ (const Matrix4< T > &rhs) const
Matrix4< T > | operator- (const Matrix4< T > &rhs) const
Matrix4< T > | operator+ (T rhs) const
Matrix4< T > | operator- (T rhs) const
Matrix4< T > | operator * (T rhs) const
Matrix4< T > | operator/ (T rhs) const
Vector4< T > | operator * (const Vector4< T > &rhs) const
Vector3< T > | operator * (const Vector3< T > &rhs) const
Matrix4< T > | operator * (Matrix4< T > rhs) const
Matrix4< T > | transpose ()
Matrix4< T > | invertTransform ()
Matrix4< T > | lerp (T fact, const Matrix4< T > &rhs) const
| operator T * ()
| operator const T * () const
## Static Public Member Functions
static Matrix4< T > | createRotationAroundAxis (T a, T b, T c)
static Matrix4< T > | createTranslation (T x, T y, T z, T w=1)
| Creates translation matrix.
## Public Attributes
T | data [16]
| Data stored in column major order.
## Friends
std::ostream & | operator<< (std::ostream &lhs, const Matrix4< T > &rhs)

## Detailed Description

### template<class T>
class Matrix4< T >

Class for matrix 4x4

Note:
  Data stored in this matrix are in column major order.

## Constructor & Destructor Documentation

template<class T>

Matrix4< T >::Matrix4 | ( |  | ) | `[inline]`

Creates identity matrix

template<class T>

Matrix4< T >::Matrix4 | ( | const T * | dt | ) | `[inline]`

Copy matrix values from array (these data must be in column major order!)

template<class T>

Matrix4< T >::Matrix4 | ( | const Matrix4< T > & | src | ) | `[inline]`

Copy constructor.

Parameters:

  | src | Data source for new created instance of Matrix4.

template<class T>
template<class FromT>

Matrix4< T >::Matrix4 | ( | const Matrix4< FromT > & | src | ) | `[inline]`

Copy casting constructor.

Parameters:

  | src | Data source for new created instance of Matrix4.

## Member Function Documentation

template<class T>

const T& Matrix4< T >::at | ( | int | x,
|  | int | y |
| ) |  |  | const`[inline]`

Get constant reference to element at postion (x,y).

Parameters:

  | x | Number of column (0..3)
  | y | Number of row (0..3)

template<class T>

T& Matrix4< T >::at | ( | int | x,
|  | int | y |
| ) |  |  | `[inline]`

Get reference to element at postion (x,y).

Parameters:

  | x | Number of column (0..3)
  | y | Number of row (0..3)

template<class T>

static Matrix4<T> Matrix4< T >::createRotationAroundAxis | ( | T | a,
|  | T | b,
|  | T | c |
| ) |  |  | `[inline, static]`

Creates rotation matrix by rotation around axis.

Parameters:

  | a | Angle (in radians) of rotation around axis X.
  | b | Angle (in radians) of rotation around axis Y.
  | c | Angle (in radians) of rotation around axis Z.

template<class T>

static Matrix4<T> Matrix4< T >::createTranslation | ( | T | x,
|  | T | y,
|  | T | z,
|  | T | w = `1` |
| ) |  |  | `[inline, static]`

Creates translation matrix.

Creates translation matrix.

Parameters:

  | x | X-direction translation
  | y | Y-direction translation
  | z | Z-direction translation
  | w | for W-coordinate translation (impictily set to 1)

template<class T>

Vector3<T> Matrix4< T >::getTranslation | ( |  | ) | `[inline]`

template<class T>

void Matrix4< T >::identity | ( |  | ) | `[inline]`

Resets matrix to be identity matrix

template<class T>

Matrix4<T> Matrix4< T >::invertTransform | ( |  | ) | `[inline]`

Creates inversion matrix to this matrix (this matrix must consists of rotation and/or translation.

Todo:
  : Fix IT!

template<class T>

Matrix4<T> Matrix4< T >::lerp | ( | T | fact,
|  | const Matrix4< T > & | rhs |
| ) |  |  | const`[inline]`

Linear interpolation of two vectors

Parameters:

  | fact | Factor of interpolation. For translation from positon of this matrix (lhs) to matrix rhs, values of factor goes from 0.0 to 1.0.
  | rhs | Second Matrix for interpolation

Note:
  Hovewer values of fact parameter are reasonable only in interval [0.0 , 1.0], you can pass also values outside of this interval and you can get result (extrapolation?)

template<class T>

Matrix4<T> Matrix4< T >::operator * | ( | Matrix4< T > | rhs | ) | const`[inline]`

Multiplication operator

Parameters:

  | rhs | Right hand side argument of binary operator.

template<class T>

Vector3<T> Matrix4< T >::operator * | ( | const Vector3< T > & | rhs | ) | const`[inline]`

Multiplication operator

Parameters:

  | rhs | Right hand side argument of binary operator.

template<class T>

Vector4<T> Matrix4< T >::operator * | ( | const Vector4< T > & | rhs | ) | const`[inline]`

Multiplication operator

Parameters:

  | rhs | Right hand side argument of binary operator.

template<class T>

Matrix4<T> Matrix4< T >::operator * | ( | T | rhs | ) | const`[inline]`

Multiplication operator

Parameters:

  | rhs | Right hand side argument of binary operator.

template<class T>

Matrix4< T >::operator const T * | ( |  | ) | const`[inline]`

Conversion to pointer operator

Returns:
  Constant Pointer to internaly stored (in managment of class Matrix4<T>) used for passing Matrix4<T> values to gl*[fd]v functions.

template<class T>

Matrix4< T >::operator T * | ( |  | ) | `[inline]`

Conversion to pointer operator

Returns:
  Pointer to internaly stored (in managment of class Matrix4<T>) used for passing Matrix4<T> values to gl*[fd]v functions.

template<class T>

bool Matrix4< T >::operator!= | ( | const Matrix4< T > & | rhs | ) | const`[inline]`

Inequality test operator

Parameters:

  | rhs | Right hand side argument of binary operator.

Returns:
  not (lhs == rhs) :-P

template<class T>

Matrix4<T> Matrix4< T >::operator+ | ( | T | rhs | ) | const`[inline]`

Addition operator

Parameters:

  | rhs | Right hand side argument of binary operator.

template<class T>

Matrix4<T> Matrix4< T >::operator+ | ( | const Matrix4< T > & | rhs | ) | const`[inline]`

Addition operator

Parameters:

  | rhs | Right hand side argument of binary operator.

template<class T>

Matrix4<T> Matrix4< T >::operator- | ( | T | rhs | ) | const`[inline]`

Substraction operator

Parameters:

  | rhs | Right hand side argument of binary operator.

template<class T>

Matrix4<T> Matrix4< T >::operator- | ( | const Matrix4< T > & | rhs | ) | const`[inline]`

Substraction operator

Parameters:

  | rhs | Right hand side argument of binary operator.

template<class T>

Matrix4<T> Matrix4< T >::operator/ | ( | T | rhs | ) | const`[inline]`

Division operator

Parameters:

  | rhs | Right hand side argument of binary operator.

template<class T>

Matrix4<T>& Matrix4< T >::operator= | ( | const T * | rhs | ) | `[inline]`

Copy operator

Parameters:

  | rhs | Right hand side argument of binary operator.

template<class T>
template<class FromT>

Matrix4<T>& Matrix4< T >::operator= | ( | const Matrix4< FromT > & | rhs | ) | `[inline]`

Copy casting operator

Parameters:

  | rhs | Right hand side argument of binary operator.

template<class T>

Matrix4<T>& Matrix4< T >::operator= | ( | const Matrix4< T > & | rhs | ) | `[inline]`

Copy operator

Parameters:

  | rhs | Right hand side argument of binary operator.

template<class T>

bool Matrix4< T >::operator== | ( | const Matrix4< T > & | rhs | ) | const`[inline]`

Equality test operator

Parameters:

  | rhs | Right hand side argument of binary operator.

Note:
  Test of equality is based of threshold epsilon value. To be two values equal, must satisfy this condition all elements of matrix | lws[i] - rhs[i] | < epsilon, same for y-coordinate, z-coordinate, and w-coordinate.

template<class T>

void Matrix4< T >::setRotation | ( | const Matrix3< T > & | m | ) | `[inline]`

Sets roation part (matrix 3x3) of matrix.

Parameters:

  | m | Rotation part of matrix

template<class T>

void Matrix4< T >::setTranslation | ( | const Vector3< T > & | v | ) | `[inline]`

Sets translation part of matrix.

Parameters:

  | v | Vector of translation to be set.

template<class T>

Matrix4<T> Matrix4< T >::transpose | ( |  | ) | `[inline]`

Transpose matrix.

## Friends And Related Function Documentation

template<class T>

std::ostream& operator<< | ( | std::ostream & | lhs,
|  | const Matrix4< T > & | rhs |
| ) |  |  | `[friend]`

Output to stream operator

Parameters:

  | lhs | Left hand side argument of operator (commonly ostream instance).
  | rhs | Right hand side argument of operator.

Returns:
  Left hand side argument - the ostream object passed to operator.

## Member Data Documentation

template<class T>

T Matrix4< T >::data[16]

Data stored in column major order.

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

- src/vectorMath/vmath.h