All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Nimble::Matrix2T< T > Class Template Reference

2x2 transformation matrix More...

#include <Nimble/Matrix2.hpp>

Public Types

typedef T type
 Data-type of the matrix.
 

Public Member Functions

void add (T v)
 Adds the given scalar to each element.
 
void clear ()
 Set all matrix elements to zero.
 
Nimble::Vector2T< T > column (int i) const
 Returns a copy of a column.
 
T * data ()
 Returns a pointer to the matrix data.
 
const T * data () const
 Returns a constant pointer to the matrix data.
 
float det () const
 Returns the determinant of the matrix.
 
get (int r, int c) const
 Gets the given matrix element.
 
void identity ()
 Create an identity matrix.
 
Matrix2T inverse (bool *ok=0, T tolerance=1.0e-8) const
 Returns the inverse of the matrix.
 
void make (T v11, T v12, T v21, T v22)
 Fills the matrix with the given values.
 
 Matrix2T ()
 Creates a matrix without initializing the elements.
 
 Matrix2T (T v11, T v12, T v21, T v22)
 Constructs a matrix and initializes it to the given values.
 
 Matrix2T (const Matrix2T &that)
 Copy constructor.
 
template<class K >
 Matrix2T (const Vector2T< K > &r1, const Vector2T< K > &r2)
 Creates a matrix and initializes it with the given row vectors.
 
bool operator!= (const Matrix2T &other) const
 Compare if two matrices are not equal Compares each element of this matrix to the given matrix. More...
 
Matrix2T operator*= (T s)
 Multiplies the matrix by a scalar.
 
bool operator== (const Matrix2T &other) const
 Compare if two matrices are equal Compares each element of this matrix to the given matrix. More...
 
Nimble::Vector2T< T > & operator[] (int i)
 Returns a reference to a row.
 
const Nimble::Vector2T< T > & operator[] (int i) const
 Returns a constant reference to a row.
 
void rotate (T)
 Create a rotation matrix. More...
 
Nimble::Vector2T< T > & row (int i)
 Returns a reference to a row.
 
const Nimble::Vector2T< T > & row (int i) const
 Returns a constant reference to a row.
 
void scale (T s)
 Create a scaling matrix.
 
void set (int r, int c, T v)
 Sets the given matrix element.
 
void transpose ()
 Transpose this matrix.
 
Matrix2T transposed () const
 Transpose this matrix.
 
 ~Matrix2T ()
 Empty destructor. More...
 

Static Public Member Functions

static int columns ()
 Returns the number of columns in this matrix type.
 
static Matrix2T makeRotation (T r)
 Returns a rotation matrix.
 
static Matrix2T makeScale (T s)
 Returns a scaling matrix.
 
static int rows ()
 Returns the number of rows in this matrix type.
 

Static Public Attributes

static const Matrix2T< T > IDENTITY
 

Detailed Description

template<class T>
class Nimble::Matrix2T< T >

2x2 transformation matrix

The rows of this matrix are of type Nimble::Vector2T<T>.

Constructor & Destructor Documentation

template<class T >
Nimble::Matrix2T< T >::~Matrix2T ( )
inline

Empty destructor.

This method is defined because otherwise some compilers might complain. We expect that a decent compiler knows how to eliminate this function.

Member Function Documentation

template<class T >
bool Nimble::Matrix2T< T >::operator!= ( const Matrix2T< T > &  other) const
inline

Compare if two matrices are not equal Compares each element of this matrix to the given matrix.

Parameters
othermatrix to compare to
Returns
true if the matrices differ
template<class T >
bool Nimble::Matrix2T< T >::operator== ( const Matrix2T< T > &  other) const
inline

Compare if two matrices are equal Compares each element of this matrix to the given matrix.

Parameters
othermatrix to compare to
Returns
true if the matrices are the same
template<class T >
void Nimble::Matrix2T< T >::rotate ( a)
inline

Create a rotation matrix.

Creates a rotation matrix.

Parameters
arotation in radians