ClanLib  2.3.7
List of all members
CL_Mat3< Type > Class Template Reference

3D matrix More...

#include <mat2.h>

Public Member Functions

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

Public Attributes

Attributes
Type matrix [9]
 

Construction

 CL_Mat3 ()
 Constructs a 3x3 matrix (uninitialised) More...
 
 CL_Mat3 (const CL_Mat3< Type > &copy)
 Constructs a 3x3 matrix (copied) More...
 
 CL_Mat3 (const CL_Mat2< Type > &copy)
 Constructs a 3x3 matrix (copied from a 2d matrix) More...
 
 CL_Mat3 (const CL_Mat4< Type > &copy)
 Constructs a 3x3 matrix (copied from a 4d matrix) More...
 
 CL_Mat3 (const float *init_matrix)
 Constructs a 3x3 matrix (copied from 9 floats) More...
 
 CL_Mat3 (Type m00, Type m01, Type m02, Type m10, Type m11, Type m12, Type m20, Type m21, Type m22)
 Constructs a 3x3 matrix (copied from specified values) More...
 
 CL_Mat3 (const double *init_matrix)
 Constructs a 3x3 matrix (copied from 9 doubles) More...
 
 CL_Mat3 (const cl_byte64 *init_matrix)
 Constructs a 3x3 matrix (copied from 9, 64 bit integers) More...
 
 CL_Mat3 (const cl_byte32 *init_matrix)
 Constructs a 3x3 matrix (copied from 9, 32 bit integers) More...
 
 CL_Mat3 (const cl_byte16 *init_matrix)
 Constructs a 3x3 matrix (copied from 9, 16 bit integers) More...
 
 CL_Mat3 (const cl_byte8 *init_matrix)
 Constructs a 3x3 matrix (copied from 9, 8 bit integers) More...
 
static CL_Mat3< Type > null ()
 
static CL_Mat3< Type > identity ()
 
static CL_Mat3< Type > rotate (const CL_Angle &angle, Type x, Type y, Type z, bool normalize=true)
 Create a rotation matrix. More...
 
static CL_Mat3< Type > multiply (const CL_Mat3< Type > &matrix_1, const CL_Mat3< Type > &matrix_2)
 Multiply 2 matrices. More...
 
static CL_Mat3< Type > add (const CL_Mat3< Type > &matrix_1, const CL_Mat3< Type > &matrix_2)
 Add 2 matrices. More...
 
static CL_Mat3< Type > subtract (const CL_Mat3< Type > &matrix_1, const CL_Mat3< Type > &matrix_2)
 Subtract 2 matrices. More...
 
static CL_Mat3< Type > adjoint (const CL_Mat3< Type > &matrix)
 Calculate the adjoint (or known as Adjugate or Conjugate Transpose) of a matrix. More...
 
static CL_Mat3< Type > inverse (const CL_Mat3< Type > &matrix)
 Calculate the matrix inverse of a matrix. More...
 
static CL_Mat3< Type > transpose (const CL_Mat3< Type > &matrix)
 Calculate the transpose of a matrix. More...
 

Detailed Description

template<typename Type>
class CL_Mat3< Type >

3D matrix

These matrix templates are defined for: int (CL_Mat3i), float (CL_Mat3f), double (CL_Mat3d)

Constructor & Destructor Documentation

template<typename Type>
CL_Mat3< Type >::CL_Mat3 ( )
inline

Constructs a 3x3 matrix (uninitialised)

template<typename Type>
CL_Mat3< Type >::CL_Mat3 ( const CL_Mat3< Type > &  copy)
inline

Constructs a 3x3 matrix (copied)

References CL_Mat3< Type >::matrix.

template<typename Type>
CL_Mat3< Type >::CL_Mat3 ( const CL_Mat2< Type > &  copy)

Constructs a 3x3 matrix (copied from a 2d matrix)

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

Constructs a 3x3 matrix (copied from a 4d matrix)

template<typename Type>
CL_Mat3< Type >::CL_Mat3 ( const float *  init_matrix)
inline

Constructs a 3x3 matrix (copied from 9 floats)

References CL_Mat3< Type >::matrix.

template<typename Type>
CL_Mat3< Type >::CL_Mat3 ( Type  m00,
Type  m01,
Type  m02,
Type  m10,
Type  m11,
Type  m12,
Type  m20,
Type  m21,
Type  m22 
)
inline

Constructs a 3x3 matrix (copied from specified values)

References CL_Mat3< Type >::matrix.

template<typename Type>
CL_Mat3< Type >::CL_Mat3 ( const double *  init_matrix)
inline

Constructs a 3x3 matrix (copied from 9 doubles)

References CL_Mat3< Type >::matrix.

template<typename Type>
CL_Mat3< Type >::CL_Mat3 ( const cl_byte64 init_matrix)
inline

Constructs a 3x3 matrix (copied from 9, 64 bit integers)

References CL_Mat3< Type >::matrix.

template<typename Type>
CL_Mat3< Type >::CL_Mat3 ( const cl_byte32 init_matrix)
inline

Constructs a 3x3 matrix (copied from 9, 32 bit integers)

References CL_Mat3< Type >::matrix.

template<typename Type>
CL_Mat3< Type >::CL_Mat3 ( const cl_byte16 init_matrix)
inline

Constructs a 3x3 matrix (copied from 9, 16 bit integers)

References CL_Mat3< Type >::matrix.

template<typename Type>
CL_Mat3< Type >::CL_Mat3 ( const cl_byte8 init_matrix)
inline

Constructs a 3x3 matrix (copied from 9, 8 bit integers)

References CL_Mat3< Type >::matrix.

Member Function Documentation

template<typename Type>
static CL_Mat3<Type> CL_Mat3< Type >::add ( const CL_Mat3< Type > &  matrix_1,
const CL_Mat3< 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

Referenced by CL_Mat3< Type >::operator+().

template<typename Type>
CL_Mat3<Type>& CL_Mat3< Type >::add ( const CL_Mat3< Type > &  add_matrix)

Add this matrix and a specified matrix.

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

Parameters
add_matrix= Matrix to add
Returns
reference to this object
template<typename Type>
static CL_Mat3<Type> CL_Mat3< Type >::adjoint ( const CL_Mat3< Type > &  matrix)
static

Calculate the adjoint (or known as Adjugate or Conjugate Transpose) of a matrix.

Parameters
matrix= The matrix to use
Returns
The adjoint matrix
template<typename Type>
CL_Mat3<Type>& CL_Mat3< Type >::adjoint ( )

Creates the adjoint (or known as adjugate) of the matrix.

Returns
reference to this object
template<typename Type>
double CL_Mat3< Type >::det ( ) const

Calculate the matrix determinant.

template<typename Type>
static CL_Mat3<Type> CL_Mat3< Type >::identity ( )
static
template<typename Type>
static CL_Mat3<Type> CL_Mat3< Type >::inverse ( const CL_Mat3< 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>
CL_Mat3<Type>& CL_Mat3< Type >::inverse ( )

Create the matrix inverse. (Returns a zero matrix if the determinent = 0)

Returns
reference to this object
template<typename Type>
static CL_Mat3<Type> CL_Mat3< Type >::multiply ( const CL_Mat3< Type > &  matrix_1,
const CL_Mat3< 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

Referenced by CL_Mat3< Type >::operator*().

template<typename Type>
CL_Mat3<Type>& CL_Mat3< Type >::multiply ( const CL_Mat3< 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_Mat3<Type> CL_Mat3< Type >::null ( )
static
template<typename Type>
CL_Mat3< Type >::operator Type * ( )
inline

Operator that returns the matrix as a array.

References CL_Mat3< Type >::matrix.

template<typename Type>
CL_Mat3< Type >::operator Type const * ( ) const
inline

Operator that returns the matrix as a array.

References CL_Mat3< Type >::matrix.

template<typename Type>
bool CL_Mat3< Type >::operator!= ( const CL_Mat3< Type > &  other)
inline

Not-equal operator.

template<typename Type>
CL_Mat3<Type> CL_Mat3< Type >::operator* ( const CL_Mat4< Type > &  mult) const
inline

Multiplication operator.

References CL_Mat3< Type >::multiply().

template<typename Type>
CL_Mat3<Type> CL_Mat3< Type >::operator+ ( const CL_Mat4< Type > &  add_matrix) const
inline

Addition operator.

References CL_Mat3< Type >::add().

template<typename Type>
CL_Mat3<Type> CL_Mat3< Type >::operator- ( const CL_Mat4< Type > &  sub_matrix) const
inline

Subtraction operator.

References CL_Mat3< Type >::subtract().

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

Copy assignment operator.

References CL_Mat3< Type >::matrix.

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

Copy assignment operator.

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

Copy assignment operator.

template<typename Type>
bool CL_Mat3< Type >::operator== ( const CL_Mat3< Type > &  other)
inline

Equality operator.

References CL_Mat3< Type >::matrix.

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

Operator that returns the matrix cell at the given index.

References CL_Mat3< Type >::matrix.

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

Operator that returns the matrix cell at the given index.

References CL_Mat3< Type >::matrix.

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

Operator that returns the matrix cell at the given index.

References CL_Mat3< Type >::matrix.

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

Operator that returns the matrix cell at the given index.

References CL_Mat3< Type >::matrix.

template<typename Type>
static CL_Mat3<Type> CL_Mat3< 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_Mat3<Type> CL_Mat3< Type >::subtract ( const CL_Mat3< Type > &  matrix_1,
const CL_Mat3< 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

Referenced by CL_Mat3< Type >::operator-().

template<typename Type>
CL_Mat3<Type>& CL_Mat3< Type >::subtract ( const CL_Mat3< Type > &  sub_matrix)

Subtract this matrix and a specified matrix.

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

Parameters
sub_matrix= Matrix to subtract
Returns
reference to this object
template<typename Type>
static CL_Mat3<Type> CL_Mat3< Type >::transpose ( const CL_Mat3< Type > &  matrix)
static

Calculate the transpose of a matrix.

Parameters
matrix= The matrix to use
Returns
The transposed matrix
template<typename Type>
CL_Mat3<Type>& CL_Mat3< Type >::transpose ( )

Calculate the transpose of this matrix.

Returns
reference to this object

Member Data Documentation

template<typename Type>
Type CL_Mat3< Type >::matrix[9]

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