Files Class List
Matrix2f Class Reference

Detailed Description

2x2 Matrix class with float type elements

+ Inheritance diagram for Matrix2f:

Public Member Functions

Unary and Binary Operators
Matrix2 operator* (const float &value) const
 
Matrix2 operator* (const Matrix2 &right) const
 
Point2< float > operator* (const Point2< float > &p) const
 
Matrix2 operator- () const
 
Matrix2 operator- (const Matrix2 &right) const
 
Matrix2 operator/ (const float &value) const
 
Matrix2 operator+ (const Matrix2 &right) const
 
Set & Get Methods
void Zero ()
 
bool IsZero () const
 
void Get (float *values)
 
void Set (const float *values)
 
void Set (const Point2< float > &x, const Point2< float > &y)
 
void SetIdentity ()
 
void SetScaledIdentity (float v)
 
void SetTensorProduct (const Point2< float > &v0, const Point2< float > &v1)
 
Affine transformations
void SetScale (const float &uniformScale)
 
void SetScale (const float &scaleX, const float &scaleY)
 
void SetScale (const Point2< float > &scale)
 
void SetNoScale ()
 
void SetRotation (float angle)
 
void SetRotation (float sinAngle, float cosAngle)
 
Set Row, Column, or Diagonal
void SetRow (int row, float x, float y)
 
void SetColumn (int column, float x, float y)
 
void SetDiagonal (const float &xx, const float &yy)
 
void SetDiagonal (const Point2< float > &p)
 
void SetDiagonal (const float *values)
 
Get Row, Column, or Diagonal
Point2< float > GetRow (int row) const
 
void GetRow (int row, Point2< float > &p) const
 
void GetRow (int row, float *values) const
 
Point2< float > GetColumn (int col) const
 
void GetColumn (int col, Point2< float > &p) const
 
void GetColumn (int col, float *values) const
 
Point2< float > GetDiagonal () const
 
void GetDiagonal (Point2< float > &p) const
 
void GetDiagonal (float *values) const
 
Comparison Operators
bool operator== (const Matrix2 &right) const
 
bool operator!= (const Matrix2 &right) const
 
Access Operators
float & operator() (int row, int column)
 
const float & operator() (int row, int column) const
 
float & operator[] (int i)
 
const float & operator[] (int i) const
 
Assignment Operators
const Matrix2operator+= (const Matrix2 &right)
 
const Matrix2operator-= (const Matrix2 &right)
 
const Matrix2operator*= (const Matrix2 &right)
 
const Matrix2operator*= (const float value)
 
const Matrix2operator/= (const float value)
 
Other Methods
void Transpose ()
 
void GetTranspose (Matrix2 &m) const
 
Matrix2 GetTranspose () const
 
Point2< float > TransposeMult (const Point2< float > &p) const
 
float GetDeterminant () const
 
void Invert ()
 
void GetInverse (Matrix2 &inverse) const
 
Matrix2 GetInverse () const
 
void OrthogonalizeX ()
 
void OrthogonalizeY ()
 
bool IsIdentity (float tollerance=float(0.001)) const
 
bool IsSymmetric (float tollerance=float(0.001)) const
 

Static Public Member Functions

Static Methods
static Matrix2 MatrixIdentity ()
 
static Matrix2 MatrixRotation (float angle)
 
static Matrix2 MatrixScale (const float &uniformScale)
 
static Matrix2 MatrixScale (const float &scaleX, const float &scaleY)
 
static Matrix2 MatrixScale (const Point2< float > &scale)
 

Public Attributes

float data [4]
 

Member Function Documentation

§ operator*() [1/3]

Matrix2 operator* ( const float &  value) const
inherited

multiply matrix by a value

§ operator*() [2/3]

Matrix2 operator* ( const Matrix2< float > &  right) const
inherited

< multiply a matrix with another

§ operator*() [3/3]

Point2<float > operator* ( const Point2< float > &  p) const
inherited

negative matrix

§ Zero()

void Zero ( )
inherited

Set all the values as zero.

§ IsZero()

bool IsZero ( ) const
inherited

Returns true if the matrix is exactly zero.

§ Get()

void Get ( float *  values)
inherited

Copies the matrix data to the given values array of size 4.

§ Set() [1/2]

void Set ( const float *  values)
inherited

Set Matrix using an array of 4 values.

§ Set() [2/2]

void Set ( const Point2< float > &  x,
const Point2< float > &  y 
)
inherited

Set Matrix using two vectors as columns.

§ SetIdentity()

void SetIdentity ( )
inherited

Converts the matrix to an identity matrix.

§ SetScaledIdentity()

void SetScaledIdentity ( float  v)
inherited

Converts the matrix to an identity matrix scaled by a scalar.

§ SetTensorProduct()

void SetTensorProduct ( const Point2< float > &  v0,
const Point2< float > &  v1 
)
inherited

Sets the matrix as the tensor product (outer product) of two vectors.

§ SetScale() [1/3]

void SetScale ( const float &  uniformScale)
inherited

Sets a uniform scale matrix.

§ SetScale() [2/3]

void SetScale ( const float &  scaleX,
const float &  scaleY 
)
inherited

Sets a scale matrix.

§ SetScale() [3/3]

void SetScale ( const Point2< float > &  scale)
inherited

Sets a scale matrix.

§ SetNoScale()

void SetNoScale ( )
inherited

Removes the scale component of the matrix.

§ SetRotation() [1/2]

void SetRotation ( float  angle)
inherited

Set a rotation matrix by angle.

§ SetRotation() [2/2]

void SetRotation ( float  sinAngle,
float  cosAngle 
)
inherited

Set a rotation matrix by cos and sin of angle.

§ SetRow()

void SetRow ( int  row,
float  x,
float  y 
)
inherited

Sets a row of the matrix.

§ SetColumn()

void SetColumn ( int  column,
float  x,
float  y 
)
inherited

Sets a column of the matrix.

§ SetDiagonal() [1/3]

void SetDiagonal ( const float &  xx,
const float &  yy 
)
inherited

Sets the diagonal values of the matrix.

§ SetDiagonal() [2/3]

void SetDiagonal ( const Point2< float > &  p)
inherited

Sets the diagonal values of the matrix.

§ SetDiagonal() [3/3]

void SetDiagonal ( const float *  values)
inherited

Sets the diagonal values of the matrix.

§ GetRow() [1/3]

Point2<float > GetRow ( int  row) const
inherited

Returns a row of the matrix.

§ GetRow() [2/3]

void GetRow ( int  row,
Point2< float > &  p 
) const
inherited

Returns a row of the matrix.

§ GetRow() [3/3]

void GetRow ( int  row,
float *  values 
) const
inherited

Returns a row of the matrix.

§ GetColumn() [1/3]

Point2<float > GetColumn ( int  col) const
inherited

Returns a column of the matrix.

§ GetColumn() [2/3]

void GetColumn ( int  col,
Point2< float > &  p 
) const
inherited

Returns a column of the matrix.

§ GetColumn() [3/3]

void GetColumn ( int  col,
float *  values 
) const
inherited

Returns a column of the matrix.

§ GetDiagonal() [1/3]

Point2<float > GetDiagonal ( ) const
inherited

Returns the diagonal of the matrix.

§ GetDiagonal() [2/3]

void GetDiagonal ( Point2< float > &  p) const
inherited

Returns the diagonal of the matrix.

§ GetDiagonal() [3/3]

void GetDiagonal ( float *  values) const
inherited

Returns the diagonal of the matrix.

§ operator==()

bool operator== ( const Matrix2< float > &  right) const
inherited

compare equal

§ operator!=()

bool operator!= ( const Matrix2< float > &  right) const
inherited

compare not equal

§ operator()() [1/2]

float & operator() ( int  row,
int  column 
)
inherited

subscript operator

§ operator()() [2/2]

const float & operator() ( int  row,
int  column 
) const
inherited

constant subscript operator

§ operator[]() [1/2]

float & operator[] ( int  i)
inherited

subscript operator

§ operator[]() [2/2]

const float & operator[] ( int  i) const
inherited

constant subscript operator

§ operator-() [1/2]

Matrix2 operator- ( ) const
inherited

negative matrix

§ operator-() [2/2]

Matrix2 operator- ( const Matrix2< float > &  right) const
inherited

subtract one Matrix2 from another

§ operator/()

Matrix2 operator/ ( const float &  value) const
inherited

divide matrix by a value;

§ operator+()

Matrix2 operator+ ( const Matrix2< float > &  right) const
inherited

add two Matrices

§ operator+=()

const Matrix2& operator+= ( const Matrix2< float > &  right)
inherited

add two Matrices modify this

§ operator-=()

const Matrix2& operator-= ( const Matrix2< float > &  right)
inherited

subtract one Matrix2 from another matrix and modify this matrix

§ operator*=() [1/2]

const Matrix2& operator*= ( const Matrix2< float > &  right)
inherited

multiply a matrix with another matrix and modify this matrix

§ operator*=() [2/2]

const Matrix2& operator*= ( const float  value)
inherited

multiply a matrix with a value modify this matrix

§ operator/=()

const Matrix2& operator/= ( const float  value)
inherited

divide the matrix by a value modify the this matrix

§ Transpose()

void Transpose ( )
inherited

Transpose this matrix.

§ GetTranspose() [1/2]

void GetTranspose ( Matrix2< float > &  m) const
inherited

< return Transpose of this matrix

§ GetTranspose() [2/2]

Matrix2 GetTranspose ( ) const
inherited

return Transpose of this matrix

§ TransposeMult()

Point2<float > TransposeMult ( const Point2< float > &  p) const
inherited

Multiply the give vector with the transpose of the matrix.

§ GetDeterminant()

float GetDeterminant ( ) const
inherited

Get the determinant of this matrix.

§ Invert()

void Invert ( )
inherited

Transpose this matrix.

§ GetInverse() [1/2]

void GetInverse ( Matrix2< float > &  inverse) const
inherited

Get the inverse of this matrix.

§ GetInverse() [2/2]

Matrix2 GetInverse ( ) const
inherited

Get the inverse of this matrix.

§ OrthogonalizeX()

void OrthogonalizeX ( )
inherited

Orthogonalizes the matrix and removes the scale component, preserving the x direction.

§ OrthogonalizeY()

void OrthogonalizeY ( )
inherited

Orthogonalizes the matrix and removes the scale component, preserving the y direction.

§ IsIdentity()

bool IsIdentity ( float  tollerance = TYPE(0.001)) const
inherited

Returns if the matrix is identity within the given error tollerance.

§ IsSymmetric()

bool IsSymmetric ( float  tollerance = TYPE(0.001)) const
inherited

Returns if the matrix is symmetric within the given error tollerance.

§ MatrixIdentity()

static Matrix2 MatrixIdentity ( )
staticinherited

Returns an identity matrix.

§ MatrixRotation()

static Matrix2 MatrixRotation ( float  angle)
staticinherited

Returns a rotation matrix about the given axis by angle in radians.

§ MatrixScale() [1/3]

static Matrix2 MatrixScale ( const float &  uniformScale)
staticinherited

Returns a uniform scale matrix.

§ MatrixScale() [2/3]

static Matrix2 MatrixScale ( const float &  scaleX,
const float &  scaleY 
)
staticinherited

Returns a scale matrix.

§ MatrixScale() [3/3]

static Matrix2 MatrixScale ( const Point2< float > &  scale)
staticinherited

Returns a scale matrix.

Member Data Documentation

§ data

float data[4]
inherited

Elements of the matrix are column-major:
| 0 2 |
| 1 3 |
.