CL_Mat4< Type > Class Template Reference
[clanCore Math]

4D matrix More...

#include <mat4.h>

List of all members.

Construction

 CL_Mat4 ()
 Constructs a 4x4 matrix (null).
 CL_Mat4 (const CL_Mat4< Type > &copy)
 Constructs a 4x4 matrix (copied).
 CL_Mat4 (const CL_Mat2< Type > &copy)
 Constructs a 4x4 matrix (copied from a 2d matrix).
 CL_Mat4 (const CL_Mat3< Type > &copy)
 Constructs a 4x4 matrix (copied from a 3d matrix).
 CL_Mat4 (const float *init_matrix)
 Constructs a 4x4 matrix (copied from a array of floats).
 CL_Mat4 (const double *init_matrix)
 Constructs a 4x4 matrix (copied from a array of doubles).
 CL_Mat4 (const cl_int64 *init_matrix)
 Constructs a 4x4 matrix (copied from a array of 64 bit integers).
 CL_Mat4 (const cl_int32 *init_matrix)
 Constructs a 4x4 matrix (copied from a array of 32 bit integers).
 CL_Mat4 (const cl_int16 *init_matrix)
 Constructs a 4x4 matrix (copied from a array of 16 bit integers).
 CL_Mat4 (const cl_int8 *init_matrix)
 Constructs a 4x4 matrix (copied from a array of 8 bit integers).
static CL_Mat4< Type > null ()
 Create a zero matrix.
static CL_Mat4< Type > identity ()
 Create the identity matrix.
static CL_Mat4< Type > frustum (Type left, Type right, Type bottom, Type top, Type z_near, Type z_far)
 Create a frustum matrix.
static CL_Mat4< Type > perspective (Type field_of_view_y_degrees, Type aspect, Type z_near, Type z_far)
 Create a perspective matrix.
static CL_Mat4< Type > ortho (Type left, Type right, Type bottom, Type top, Type z_near, Type z_far)
 Create a ortho matrix.
static CL_Mat4< Type > ortho_2d (Type left, Type right, Type bottom, Type top)
 Create a ortho_2d matrix.
static CL_Mat4< Type > rotate (const CL_Angle &angle, Type x, Type y, Type z, bool normalize=true)
 Create a rotation matrix.
static CL_Mat4< Type > scale (Type x, Type y, Type z)
 Create a scale matrix.
static CL_Mat4< Type > translate (Type x, Type y, Type z)
 Create a translation matrix.
static CL_Mat4< Type > look_at (Type eye_x, Type eye_y, Type eye_z, Type center_x, Type center_y, Type center_z, Type up_x, Type up_y, Type up_z)
 Create the "look at" matrix.
static CL_Mat4< Type > multiply (const CL_Mat4< Type > &matrix_1, const CL_Mat4< Type > &matrix_2)
 Multiply 2 matrices.
static CL_Mat4< Type > add (const CL_Mat4< Type > &matrix_1, const CL_Mat4< Type > &matrix_2)
 Add 2 matrices.
static CL_Mat4< Type > subtract (const CL_Mat4< Type > &matrix_1, const CL_Mat4< Type > &matrix_2)
 Subtract 2 matrices.
static CL_Mat4< Type > adjoint (const CL_Mat4< Type > &matrix)
 Calculate the adjoint (or known as adjugate) of a matrix.
static CL_Mat4< Type > inverse (const CL_Mat4< Type > &matrix)
 Calculate the matrix inverse of a matrix.

Attributes

Type get_origin_x () const
 Returns the x coordinate for the point (0,0,0) multiplied with this matrix.
Type get_origin_y () const
 Returns the y coordinate for the point (0,0,0) multiplied with this matrix.
Type get_origin_z () const
 Returns the z coordinate for the point (0,0,0) multiplied with this matrix.
Type matrix [16]
 The matrix (in column-major format).

Public Member Functions

Operations
CL_Mat4< Type > & multiply (const CL_Mat4< Type > &mult)
 Multiply this matrix and a specified matrix.
CL_Mat4< Type > & add (const CL_Mat4< Type > &add_matrix)
 Add this matrix and a specified matrix.
CL_Mat4< Type > & subtract (const CL_Mat4< Type > &sub_matrix)
 Subtract this matrix and a specified matrix.
CL_Mat4< Type > & scale_self (Type x, Type y, Type z)
 Scale this matrix.
CL_Mat4< Type > & translate_self (Type x, Type y, Type z)
 Translate this matrix.
double det () const
 Calculate the matrix determinant of this matrix.
CL_Mat4< Type > & adjoint ()
 Calculate the adjoint (or known as adjugate) of this matrix.
CL_Mat4< Type > & inverse ()
 Calculate the matrix inverse of this matrix.
Operators
 operator Type const * () const
 Operator that returns the matrix as a array.
 operator Type * ()
 Operator that returns the matrix as a array.
Type & operator[] (int i)
 Operator that returns the matrix cell at the given index.
const Type & operator[] (int i) const
 Operator that returns the matrix cell at the given index.
Type & operator[] (unsigned int i)
 Operator that returns the matrix cell at the given index.
const Type & operator[] (unsigned int i) const
 Operator that returns the matrix cell at the given index.
CL_Mat4< Type > & operator= (const CL_Mat4< Type > &copy)
 Copy assignment operator.
CL_Mat4< Type > & operator= (const CL_Mat3< Type > &copy)
 Copy assignment operator.
CL_Mat4< Type > & operator= (const CL_Mat2< Type > &copy)
 Copy assignment operator.
CL_Mat4< Type > operator * (const CL_Mat4< Type > &mult) const
 Multiplication operator.
CL_Mat4< Type > operator+ (const CL_Mat4< Type > &add_matrix) const
 Addition operator.
CL_Mat4< Type > operator- (const CL_Mat4< Type > &sub_matrix) const
 Subtraction operator.
bool operator== (const CL_Mat4< Type > &other)
 Equality operator.
bool operator!= (const CL_Mat4< Type > &other)
 Not-equal operator.


Detailed Description

template<typename Type>
class CL_Mat4< Type >

4D matrix

These matrix templates are defined for: int (CL_Mat4i), float (CL_Mat4f), double (CL_Mat4d)


Constructor & Destructor Documentation

template<typename Type>
CL_Mat4< Type >::CL_Mat4  )  [inline]
 

Constructs a 4x4 matrix (null).

template<typename Type>
CL_Mat4< Type >::CL_Mat4 const CL_Mat4< Type > &  copy  )  [inline]
 

Constructs a 4x4 matrix (copied).

template<typename Type>
CL_Mat4< Type >::CL_Mat4 const CL_Mat2< Type > &  copy  ) 
 

Constructs a 4x4 matrix (copied from a 2d matrix).

template<typename Type>
CL_Mat4< Type >::CL_Mat4 const CL_Mat3< Type > &  copy  ) 
 

Constructs a 4x4 matrix (copied from a 3d matrix).

template<typename Type>
CL_Mat4< Type >::CL_Mat4 const float *  init_matrix  )  [inline]
 

Constructs a 4x4 matrix (copied from a array of floats).

template<typename Type>
CL_Mat4< Type >::CL_Mat4 const double *  init_matrix  )  [inline]
 

Constructs a 4x4 matrix (copied from a array of doubles).

template<typename Type>
CL_Mat4< Type >::CL_Mat4 const cl_int64 init_matrix  )  [inline]
 

Constructs a 4x4 matrix (copied from a array of 64 bit integers).

template<typename Type>
CL_Mat4< Type >::CL_Mat4 const cl_int32 init_matrix  )  [inline]
 

Constructs a 4x4 matrix (copied from a array of 32 bit integers).

template<typename Type>
CL_Mat4< Type >::CL_Mat4 const cl_int16 init_matrix  )  [inline]
 

Constructs a 4x4 matrix (copied from a array of 16 bit integers).

template<typename Type>
CL_Mat4< Type >::CL_Mat4 const cl_int8 init_matrix  )  [inline]
 

Constructs a 4x4 matrix (copied from a array of 8 bit integers).


Member Function Documentation

template<typename Type>
CL_Mat4<Type>& CL_Mat4< Type >::add const CL_Mat4< Type > &  add_matrix  ) 
 

Add this matrix and a specified matrix.

This adds the matrix as follows: this = mult + this

Parameters:
add_matrix = Matrix to add
Returns:
reference to this object

template<typename Type>
static CL_Mat4<Type> CL_Mat4< Type >::add const CL_Mat4< Type > &  matrix_1,
const CL_Mat4< Type > &  matrix_2
[static]
 

Add 2 matrices.

This adds the matrix as follows: result = matrix1 + matrix2

Parameters:
matrix_1 = First Matrix to add
matrix_2 = Second Matrix to add
Returns:
The matrix

template<typename Type>
CL_Mat4<Type>& CL_Mat4< Type >::adjoint  ) 
 

Calculate the adjoint (or known as adjugate) of this matrix.

Returns:
reference to this object

template<typename Type>
static CL_Mat4<Type> CL_Mat4< Type >::adjoint const CL_Mat4< Type > &  matrix  )  [static]
 

Calculate the adjoint (or known as adjugate) of a matrix.

Parameters:
matrix = The matrix to use
Returns:
The adjoint matrix

template<typename Type>
double CL_Mat4< Type >::det  )  const
 

Calculate the matrix determinant of this matrix.

Returns:
The determinant

template<typename Type>
static CL_Mat4<Type> CL_Mat4< Type >::frustum Type  left,
Type  right,
Type  bottom,
Type  top,
Type  z_near,
Type  z_far
[static]
 

Create a frustum matrix.

Matrix is created in the Column-Major matrix format (opengl native)

Returns:
The matrix (in column-major format)

template<typename Type>
Type CL_Mat4< Type >::get_origin_x  )  const [inline]
 

Returns the x coordinate for the point (0,0,0) multiplied with this matrix.

template<typename Type>
Type CL_Mat4< Type >::get_origin_y  )  const [inline]
 

Returns the y coordinate for the point (0,0,0) multiplied with this matrix.

template<typename Type>
Type CL_Mat4< Type >::get_origin_z  )  const [inline]
 

Returns the z coordinate for the point (0,0,0) multiplied with this matrix.

template<typename Type>
static CL_Mat4<Type> CL_Mat4< Type >::identity  )  [static]
 

Create the identity matrix.

Returns:
The matrix

template<typename Type>
CL_Mat4<Type>& CL_Mat4< Type >::inverse  ) 
 

Calculate the matrix inverse of this matrix.

Creates a zero matrix if the determinent == 0

Returns:
reference to this object

template<typename Type>
static CL_Mat4<Type> CL_Mat4< Type >::inverse const CL_Mat4< Type > &  matrix  )  [static]
 

Calculate the matrix inverse of a matrix.

Creates a zero matrix if the determinent == 0

Parameters:
matrix = The matrix to use
Returns:
The inversed matrix

template<typename Type>
static CL_Mat4<Type> CL_Mat4< Type >::look_at Type  eye_x,
Type  eye_y,
Type  eye_z,
Type  center_x,
Type  center_y,
Type  center_z,
Type  up_x,
Type  up_y,
Type  up_z
[static]
 

Create the "look at" matrix.

Matrix is created in the Column-Major matrix format (opengl native)

Parameters:
eye_x = Eye position X
eye_y = Eye position Y
eye_z = Eye position Z
center_x = Center X
center_y = Center Y
center_z = Center Z
up_x = Translation X
up_y = Translation Y
up_z = Translation Z
Returns:
The matrix (in column-major format)

template<typename Type>
CL_Mat4<Type>& CL_Mat4< Type >::multiply const CL_Mat4< Type > &  mult  ) 
 

Multiply this matrix and a specified matrix.

This multiplies the matrix as follows: this = mult * this

Parameters:
mult = Matrix to multiply
Returns:
reference to this object

template<typename Type>
static CL_Mat4<Type> CL_Mat4< Type >::multiply const CL_Mat4< Type > &  matrix_1,
const CL_Mat4< Type > &  matrix_2
[static]
 

Multiply 2 matrices.

This multiplies the matrix as follows: result = matrix1 * matrix2

Parameters:
matrix_1 = First Matrix to multiply
matrix_2 = Second Matrix to multiply
Returns:
The matrix

template<typename Type>
static CL_Mat4<Type> CL_Mat4< Type >::null  )  [static]
 

Create a zero matrix.

Returns:
The matrix

template<typename Type>
CL_Mat4<Type> CL_Mat4< Type >::operator * const CL_Mat4< Type > &  mult  )  const [inline]
 

Multiplication operator.

template<typename Type>
CL_Mat4< Type >::operator Type *  )  [inline]
 

Operator that returns the matrix as a array.

template<typename Type>
CL_Mat4< Type >::operator Type const *  )  const [inline]
 

Operator that returns the matrix as a array.

template<typename Type>
bool CL_Mat4< Type >::operator!= const CL_Mat4< Type > &  other  )  [inline]
 

Not-equal operator.

template<typename Type>
CL_Mat4<Type> CL_Mat4< Type >::operator+ const CL_Mat4< Type > &  add_matrix  )  const [inline]
 

Addition operator.

template<typename Type>
CL_Mat4<Type> CL_Mat4< Type >::operator- const CL_Mat4< Type > &  sub_matrix  )  const [inline]
 

Subtraction operator.

template<typename Type>
CL_Mat4<Type>& CL_Mat4< Type >::operator= const CL_Mat2< Type > &  copy  ) 
 

Copy assignment operator.

template<typename Type>
CL_Mat4<Type>& CL_Mat4< Type >::operator= const CL_Mat3< Type > &  copy  ) 
 

Copy assignment operator.

template<typename Type>
CL_Mat4<Type>& CL_Mat4< Type >::operator= const CL_Mat4< Type > &  copy  )  [inline]
 

Copy assignment operator.

template<typename Type>
bool CL_Mat4< Type >::operator== const CL_Mat4< Type > &  other  )  [inline]
 

Equality operator.

template<typename Type>
const Type& CL_Mat4< Type >::operator[] unsigned int  i  )  const [inline]
 

Operator that returns the matrix cell at the given index.

template<typename Type>
Type& CL_Mat4< Type >::operator[] unsigned int  i  )  [inline]
 

Operator that returns the matrix cell at the given index.

template<typename Type>
const Type& CL_Mat4< Type >::operator[] int  i  )  const [inline]
 

Operator that returns the matrix cell at the given index.

template<typename Type>
Type& CL_Mat4< Type >::operator[] int  i  )  [inline]
 

Operator that returns the matrix cell at the given index.

template<typename Type>
static CL_Mat4<Type> CL_Mat4< Type >::ortho Type  left,
Type  right,
Type  bottom,
Type  top,
Type  z_near,
Type  z_far
[static]
 

Create a ortho matrix.

Matrix is created in the Column-Major matrix format (opengl native)

Returns:
The matrix (in column-major format)

template<typename Type>
static CL_Mat4<Type> CL_Mat4< Type >::ortho_2d Type  left,
Type  right,
Type  bottom,
Type  top
[static]
 

Create a ortho_2d matrix.

Matrix is created in the Column-Major matrix format (opengl native)

Returns:
The matrix (in column-major format)

template<typename Type>
static CL_Mat4<Type> CL_Mat4< Type >::perspective Type  field_of_view_y_degrees,
Type  aspect,
Type  z_near,
Type  z_far
[static]
 

Create a perspective matrix.

Matrix is created in the Column-Major matrix format (opengl native)

Returns:
The matrix (in column-major format)

template<typename Type>
static CL_Mat4<Type> CL_Mat4< Type >::rotate const CL_Angle angle,
Type  x,
Type  y,
Type  z,
bool  normalize = true
[static]
 

Create a rotation matrix.

Matrix is created in the Column-Major matrix format (opengl native)

Parameters:
angle = Angle to rotate by
x = Amount to rotate in the X axis
y = Amount to rotate in the Y axis
z = Amount to rotate in the Z axis
normalize = true = Normalize x,y,z before creating rotation matrix
Returns:
The matrix (in column-major format)

template<typename Type>
static CL_Mat4<Type> CL_Mat4< Type >::scale Type  x,
Type  y,
Type  z
[static]
 

Create a scale matrix.

Parameters:
x = Scale X
y = Scale Y
z = Scale Z
Returns:
The matrix

template<typename Type>
CL_Mat4<Type>& CL_Mat4< Type >::scale_self Type  x,
Type  y,
Type  z
 

Scale this matrix.

This is faster than using: multiply(CL_Mat4<Type>::scale(x,y,z) )

Parameters:
x = Scale X
y = Scale Y
z = Scale Z
Returns:
reference to this object

template<typename Type>
CL_Mat4<Type>& CL_Mat4< Type >::subtract const CL_Mat4< Type > &  sub_matrix  ) 
 

Subtract this matrix and a specified matrix.

This subtracts the matrix as follows: this = mult - this

Parameters:
sub_matrix = Matrix to subtract
Returns:
reference to this object

template<typename Type>
static CL_Mat4<Type> CL_Mat4< Type >::subtract const CL_Mat4< Type > &  matrix_1,
const CL_Mat4< Type > &  matrix_2
[static]
 

Subtract 2 matrices.

This subtracts the matrix as follows: result = matrix1 - matrix2

Parameters:
matrix_1 = First Matrix to subtract
matrix_2 = Second Matrix to subtract
Returns:
The matrix

template<typename Type>
static CL_Mat4<Type> CL_Mat4< Type >::translate Type  x,
Type  y,
Type  z
[static]
 

Create a translation matrix.

Matrix is created in the Column-Major matrix format (opengl native)

Parameters:
x = Translate X
y = Translate Y
z = Translate Z
Returns:
The matrix (in column-major format)

template<typename Type>
CL_Mat4<Type>& CL_Mat4< Type >::translate_self Type  x,
Type  y,
Type  z
 

Translate this matrix.

Matrix is assumed to be in the Column-Major matrix format (opengl native)
This is faster than using: multiply(CL_Mat4<Type>::translate(x,y,z) )

Parameters:
x = Translate X
y = Translate Y
z = Translate Z
Returns:
reference to this object


Member Data Documentation

template<typename Type>
Type CL_Mat4< Type >::matrix[16]
 

The matrix (in column-major format).


The documentation for this class was generated from the following file:
Generated on Thu Dec 3 02:39:39 2009 for ClanLib by  doxygen 1.4.6