kn::Matrix4x4< T > Class Template Reference

#include <Matrix4x4.hpp>

Inherits Matrix< T >.

Collaboration diagram for kn::Matrix4x4< T >:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 Matrix4x4 (void)
 Default constructor Create a 4*4 matrix set to identity.
 Matrix4x4 (const Matrix4x4< T > &m)
 Copy constructor Create a matrix by copying the input matrix.
 Matrix4x4 (const Matrix< T > &m)
 Constructor form Matrix Create a matrix by copying the input matrix.
 Matrix4x4 (const Matrix4x4< T > *m)
 Copy constructor Create a matrix by copying the input matrix.
 Matrix4x4 (const T &d)
 Create a 4*4 matrix Create a 4*4 matrix and use the value d to set the data of the matrix.
 Matrix4x4 (const T *d)
 create a 4*4 matrix create a 4*4 matrix and set data by using the values array d
 Matrix4x4 (const Vector< T > &v, const bool &setasrows=true)
 Create a 4*4 or matrix Create a matrix using the vector v.
 Matrix4x4 (const Vector4< T > *v, const bool &setasrows=true)
 Create a 4*4 matrix Create a matrix using the pointer on the vector v.
 ~Matrix4x4 (void)
 Destructor.
Vector4< T > operator* (const Vector4< T > &v) const
 Multiplies the matrix with a vector.
size_t rows (void) const
 Returns the number of rows of the matrix.
size_t columns (void) const
 Returns the number of columns of the matrix.
Matrix4x4< T > & transpose (void)
 Transposes inplace the current matrix.
void setIdentity (void)
 sets the matrix to identity
bool isSquare (void) const
 Check if it is a square matrix or not.
Matrix4x4< T > & operator= (const Matrix4x4< T > &m)
 Allocate the matrix m to this matrix.
Matrix4x4< T > operator+ (const Matrix4x4< T > &m) const
 Adds two matrices.
Matrix4x4< T > operator- (const Matrix4x4< T > &m) const
 Subtracts two matrices.
Matrix4x4< T > operator/ (const T &d) const
 Divides the matrix with a value.
Matrix4x4< T > operator* (const Matrix4x4< T > &m) const
 Multiplies two matrices.
Matrix4x4< T > operator* (const T &d) const
 Multiplies the matrix with a value.
Matrix4x4< T > operator- (void) const
 Compute opposite of the matrix.
Matrix4x4< T > & operator+= (const Matrix4x4< T > &m)
 Adds the matrix with a matrix.
Matrix4x4< T > & operator-= (const Matrix4x4< T > &m)
 Subtracts the matrix with a matrix.
Matrix4x4< T > & operator/= (const T &d)
 Divides the matrix with a value All values of the matrix are divided by d.
Matrix4x4< T > & operator*= (const Matrix4x4< T > &m)
 Multiplies the matrix with a matrix.
Matrix4x4< T > & operator*= (const T &d)
 Multiplies the matrix with a value.
Vector4< T > getRow (const unsigned int &row) const
 Returns a vector with values from a specific row.
Vector4< T > getColumn (const unsigned int &column) const
 Returns a vector with values from a specific column.
Vector4< T > getDiagonal (void) const
 Return the diagonal of the matrix as a vector.
Matrix4x4< T > getTranspose (void) const
 Transposes a copy of the matrix Creates and transposes a copy of this matrix.
Matrix4x4< T > & power (const unsigned int &p)
 Computes inplace the power p of this matrix.
trace (void) const
 Trace of the Matrix.


Detailed Description

template<class T>
class kn::Matrix4x4< T >

Definition at line 38 of file Matrix4x4.hpp.


Constructor & Destructor Documentation

template<class T>
kn::Matrix4x4< T >::Matrix4x4 ( void   )  [inline]

Default constructor Create a 4*4 matrix set to identity.

Definition at line 48 of file Matrix4x4.hpp.

template<class T>
kn::Matrix4x4< T >::Matrix4x4 ( const Matrix4x4< T > &  m  )  [inline]

Copy constructor Create a matrix by copying the input matrix.

Parameters:
m the matrix to copy

Definition at line 58 of file Matrix4x4.hpp.

template<class T >
kn::Matrix4x4< T >::Matrix4x4 ( const Matrix< T > &  m  )  [inline]

Constructor form Matrix Create a matrix by copying the input matrix.

Parameters:
m the matrix to copy
Exceptions:
MathException if m dimensions are differents

Definition at line 378 of file Matrix4x4.hpp.

template<class T >
kn::Matrix4x4< T >::Matrix4x4 ( const Matrix4x4< T > *  m  )  [inline]

Copy constructor Create a matrix by copying the input matrix.

Parameters:
m the pointer to the matrix to copy
Exceptions:
MathException pointer is null

Definition at line 318 of file Matrix4x4.hpp.

template<class T>
kn::Matrix4x4< T >::Matrix4x4 ( const T &  d  )  [inline]

Create a 4*4 matrix Create a 4*4 matrix and use the value d to set the data of the matrix.

Parameters:
d value used to set data of the matrix

Definition at line 84 of file Matrix4x4.hpp.

template<class T >
kn::Matrix4x4< T >::Matrix4x4 ( const T *  d  )  [inline]

create a 4*4 matrix create a 4*4 matrix and set data by using the values array d

Parameters:
d pointer to an array of data
Exceptions:
MathException d is null

Definition at line 329 of file Matrix4x4.hpp.

template<class T >
kn::Matrix4x4< T >::Matrix4x4 ( const Vector< T > &  v,
const bool &  setasrows = true 
) [inline]

Create a 4*4 or matrix Create a matrix using the vector v.

if setasrows is set to true, v is used to fill rows of the matrix, v is used to fill columns otherwise

Parameters:
v a vector
setasrows defined if vector is used to fill columns or rows
Exceptions:
MathException size of vector is different of 3

Definition at line 339 of file Matrix4x4.hpp.

template<class T >
kn::Matrix4x4< T >::Matrix4x4 ( const Vector4< T > *  v,
const bool &  setasrows = true 
) [inline]

Create a 4*4 matrix Create a matrix using the pointer on the vector v.

If setasrows is set to true, v is used to fill rows of the matrix, v is used to fill columns otherwise

Parameters:
v a pointer on an array of vectors
setasrows defined if vector is used to fill columns or rows
Exceptions:
MathException v is null
MathException if *v size are different of 3

Definition at line 357 of file Matrix4x4.hpp.

template<class T>
kn::Matrix4x4< T >::~Matrix4x4 ( void   )  [inline]

Destructor.

Definition at line 122 of file Matrix4x4.hpp.


Member Function Documentation

template<class T>
size_t kn::Matrix4x4< T >::columns ( void   )  const [inline]

Returns the number of columns of the matrix.

Returns:
the number of columns

Reimplemented from kn::Matrix< T >.

Definition at line 150 of file Matrix4x4.hpp.

template<typename T >
Vector4< T > kn::Matrix4x4< T >::getColumn ( const unsigned int &  column  )  const [inline]

Returns a vector with values from a specific column.

Parameters:
column the number of the column
Returns:
a vector of values
Exceptions:
MathException column is out of bounds

Reimplemented from kn::Matrix< T >.

Definition at line 584 of file Matrix4x4.hpp.

template<typename T >
Vector4< T > kn::Matrix4x4< T >::getDiagonal ( void   )  const [inline]

Return the diagonal of the matrix as a vector.

Returns:
a vector

Reimplemented from kn::Matrix< T >.

Definition at line 566 of file Matrix4x4.hpp.

template<typename T >
Vector4< T > kn::Matrix4x4< T >::getRow ( const unsigned int &  row  )  const [inline]

Returns a vector with values from a specific row.

Parameters:
row the number of the row
Returns:
a vector of values
Exceptions:
MathException row is out of bounds

Reimplemented from kn::Matrix< T >.

Definition at line 574 of file Matrix4x4.hpp.

template<class T>
Matrix4x4<T> kn::Matrix4x4< T >::getTranspose ( void   )  const [inline]

Transposes a copy of the matrix Creates and transposes a copy of this matrix.

The current matrix is unchanged

Returns:
the transposed copy of the matrix

Reimplemented from kn::Matrix< T >.

Definition at line 293 of file Matrix4x4.hpp.

template<class T>
bool kn::Matrix4x4< T >::isSquare ( void   )  const [inline]

Check if it is a square matrix or not.

Returns:
if the matrix is square

Reimplemented from kn::Matrix< T >.

Definition at line 169 of file Matrix4x4.hpp.

template<typename T >
Matrix4x4< T > kn::Matrix4x4< T >::operator* ( const T &  d  )  const [inline]

Multiplies the matrix with a value.

Parameters:
d the value multiplied with this matrix
Returns:
a copy of the matrix

Reimplemented from kn::Matrix< T >.

Definition at line 491 of file Matrix4x4.hpp.

template<typename T >
Matrix4x4< T > kn::Matrix4x4< T >::operator* ( const Matrix4x4< T > &  m  )  const [inline]

Multiplies two matrices.

Parameters:
m the matrix multiplied with this matrix
Returns:
a copy of the matrix
Exceptions:
MathException matrice size is incorrect

Definition at line 473 of file Matrix4x4.hpp.

template<class T >
Vector4< T > kn::Matrix4x4< T >::operator* ( const Vector4< T > &  v  )  const [inline]

Multiplies the matrix with a vector.

Parameters:
v the vector multiplied with this matrix
Returns:
a vector
Exceptions:
MathException vector size is incorrect

Definition at line 387 of file Matrix4x4.hpp.

template<typename T >
Matrix4x4< T > & kn::Matrix4x4< T >::operator*= ( const T &  d  )  [inline]

Multiplies the matrix with a value.

Parameters:
d the value multiplied with this matrix
Returns:
the matrix

Reimplemented from kn::Matrix< T >.

Definition at line 545 of file Matrix4x4.hpp.

template<typename T >
Matrix4x4< T > & kn::Matrix4x4< T >::operator*= ( const Matrix4x4< T > &  m  )  [inline]

Multiplies the matrix with a matrix.

Parameters:
m the matrix multiplied with this matrix
Returns:
the matrix
Exceptions:
MathException matrix size is incorrect

Definition at line 529 of file Matrix4x4.hpp.

template<typename T >
Matrix4x4< T > kn::Matrix4x4< T >::operator+ ( const Matrix4x4< T > &  m  )  const [inline]

Adds two matrices.

Parameters:
m the matrix added to this matrix
Returns:
a copy of the matrix
Exceptions:
MathException matrix size is incorrect

Definition at line 449 of file Matrix4x4.hpp.

template<typename T >
Matrix4x4< T > & kn::Matrix4x4< T >::operator+= ( const Matrix4x4< T > &  m  )  [inline]

Adds the matrix with a matrix.

Parameters:
m the matrix added with this matrix
Returns:
the matrix
Exceptions:
MathException matrix size is incorrect

Definition at line 507 of file Matrix4x4.hpp.

template<typename T >
Matrix4x4< T > kn::Matrix4x4< T >::operator- ( void   )  const [inline]

Compute opposite of the matrix.

Returns:
a copy of the matrix

Reimplemented from kn::Matrix< T >.

Definition at line 499 of file Matrix4x4.hpp.

template<typename T >
Matrix4x4< T > kn::Matrix4x4< T >::operator- ( const Matrix4x4< T > &  m  )  const [inline]

Subtracts two matrices.

Parameters:
m the matrix subtracted to this matrix
Returns:
a copy of the matrix
Exceptions:
MathException matrix size is incorrect

Definition at line 457 of file Matrix4x4.hpp.

template<typename T >
Matrix4x4< T > & kn::Matrix4x4< T >::operator-= ( const Matrix4x4< T > &  m  )  [inline]

Subtracts the matrix with a matrix.

Parameters:
m the matrix subtracted with this matrix
Returns:
the matrix
Exceptions:
MathException matrix size is incorrect

Definition at line 514 of file Matrix4x4.hpp.

template<typename T >
Matrix4x4< T > kn::Matrix4x4< T >::operator/ ( const T &  d  )  const [inline]

Divides the matrix with a value.

Parameters:
d the value divided with this matrix
Returns:
a copy of the matrix
Exceptions:
MathException d is null

Reimplemented from kn::Matrix< T >.

Definition at line 465 of file Matrix4x4.hpp.

template<typename T >
Matrix4x4< T > & kn::Matrix4x4< T >::operator/= ( const T &  d  )  [inline]

Divides the matrix with a value All values of the matrix are divided by d.

Parameters:
d the value divided with this matrix
Returns:
the matrix
Exceptions:
MathException d is null

Reimplemented from kn::Matrix< T >.

Definition at line 520 of file Matrix4x4.hpp.

template<typename T >
Matrix4x4< T > & kn::Matrix4x4< T >::operator= ( const Matrix4x4< T > &  m  )  [inline]

Allocate the matrix m to this matrix.

Parameters:
m the matrix used to defined this matrix
Returns:
the matrix
Exceptions:
MathException matrix size is incorrect

Definition at line 439 of file Matrix4x4.hpp.

template<typename T >
Matrix4x4< T > & kn::Matrix4x4< T >::power ( const unsigned int &  p  )  [inline]

Computes inplace the power p of this matrix.

Returns:
this matrix
Exceptions:
MathException not a square matrix

Reimplemented from kn::Matrix< T >.

Definition at line 552 of file Matrix4x4.hpp.

template<class T>
size_t kn::Matrix4x4< T >::rows ( void   )  const [inline]

Returns the number of rows of the matrix.

Returns:
the number of rows

Reimplemented from kn::Matrix< T >.

Definition at line 142 of file Matrix4x4.hpp.

template<class T >
void kn::Matrix4x4< T >::setIdentity ( void   )  [inline]

sets the matrix to identity

Reimplemented from kn::Matrix< T >.

Definition at line 410 of file Matrix4x4.hpp.

template<typename T >
T kn::Matrix4x4< T >::trace ( void   )  const [inline]

Trace of the Matrix.

This represents the sum of each element on the diagonal

Returns:
the trace

Reimplemented from kn::Matrix< T >.

Definition at line 601 of file Matrix4x4.hpp.

template<class T >
Matrix4x4< T > & kn::Matrix4x4< T >::transpose ( void   )  [inline]

Transposes inplace the current matrix.

Returns:
this transposed matrix

Reimplemented from kn::Matrix< T >.

Definition at line 400 of file Matrix4x4.hpp.


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

Generated on Thu Nov 12 16:06:35 2009 for OpenKN-math by  doxygen 1.5.8