Files Class List
Matrix2d Class Reference

Detailed Description

2x2 Matrix class with double type elements

+ Inheritance diagram for Matrix2d:

Public Member Functions

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

Static Public Member Functions

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

Public Attributes

double data [4]
 

Member Function Documentation

§ operator*() [1/3]

Matrix2 operator* ( const double &  value) const
inherited

multiply matrix by a value

§ operator*() [2/3]

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

< multiply a matrix with another

§ operator*() [3/3]

Point2<double > operator* ( const Point2< double > &  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 ( double *  values)
inherited

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

§ Set() [1/2]

void Set ( const double *  values)
inherited

Set Matrix using an array of 4 values.

§ Set() [2/2]

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

Set Matrix using two vectors as columns.

§ SetIdentity()

void SetIdentity ( )
inherited

Converts the matrix to an identity matrix.

§ SetScaledIdentity()

void SetScaledIdentity ( double  v)
inherited

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

§ SetTensorProduct()

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

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

§ SetScale() [1/3]

void SetScale ( const double &  uniformScale)
inherited

Sets a uniform scale matrix.

§ SetScale() [2/3]

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

Sets a scale matrix.

§ SetScale() [3/3]

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

Sets a scale matrix.

§ SetNoScale()

void SetNoScale ( )
inherited

Removes the scale component of the matrix.

§ SetRotation() [1/2]

void SetRotation ( double  angle)
inherited

Set a rotation matrix by angle.

§ SetRotation() [2/2]

void SetRotation ( double  sinAngle,
double  cosAngle 
)
inherited

Set a rotation matrix by cos and sin of angle.

§ SetRow()

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

Sets a row of the matrix.

§ SetColumn()

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

Sets a column of the matrix.

§ SetDiagonal() [1/3]

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

Sets the diagonal values of the matrix.

§ SetDiagonal() [2/3]

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

Sets the diagonal values of the matrix.

§ SetDiagonal() [3/3]

void SetDiagonal ( const double *  values)
inherited

Sets the diagonal values of the matrix.

§ GetRow() [1/3]

Point2<double > GetRow ( int  row) const
inherited

Returns a row of the matrix.

§ GetRow() [2/3]

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

Returns a row of the matrix.

§ GetRow() [3/3]

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

Returns a row of the matrix.

§ GetColumn() [1/3]

Point2<double > GetColumn ( int  col) const
inherited

Returns a column of the matrix.

§ GetColumn() [2/3]

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

Returns a column of the matrix.

§ GetColumn() [3/3]

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

Returns a column of the matrix.

§ GetDiagonal() [1/3]

Point2<double > GetDiagonal ( ) const
inherited

Returns the diagonal of the matrix.

§ GetDiagonal() [2/3]

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

Returns the diagonal of the matrix.

§ GetDiagonal() [3/3]

void GetDiagonal ( double *  values) const
inherited

Returns the diagonal of the matrix.

§ operator==()

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

compare equal

§ operator!=()

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

compare not equal

§ operator()() [1/2]

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

subscript operator

§ operator()() [2/2]

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

constant subscript operator

§ operator[]() [1/2]

double & operator[] ( int  i)
inherited

subscript operator

§ operator[]() [2/2]

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

constant subscript operator

§ operator-() [1/2]

Matrix2 operator- ( ) const
inherited

negative matrix

§ operator-() [2/2]

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

subtract one Matrix2 from another

§ operator/()

Matrix2 operator/ ( const double &  value) const
inherited

divide matrix by a value;

§ operator+()

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

add two Matrices

§ operator+=()

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

add two Matrices modify this

§ operator-=()

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

subtract one Matrix2 from another matrix and modify this matrix

§ operator*=() [1/2]

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

multiply a matrix with another matrix and modify this matrix

§ operator*=() [2/2]

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

multiply a matrix with a value modify this matrix

§ operator/=()

const Matrix2& operator/= ( const double  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< double > &  m) const
inherited

< return Transpose of this matrix

§ GetTranspose() [2/2]

Matrix2 GetTranspose ( ) const
inherited

return Transpose of this matrix

§ TransposeMult()

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

Multiply the give vector with the transpose of the matrix.

§ GetDeterminant()

double GetDeterminant ( ) const
inherited

Get the determinant of this matrix.

§ Invert()

void Invert ( )
inherited

Transpose this matrix.

§ GetInverse() [1/2]

void GetInverse ( Matrix2< double > &  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 ( double  tollerance = TYPE(0.001)) const
inherited

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

§ IsSymmetric()

bool IsSymmetric ( double  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 ( double  angle)
staticinherited

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

§ MatrixScale() [1/3]

static Matrix2 MatrixScale ( const double &  uniformScale)
staticinherited

Returns a uniform scale matrix.

§ MatrixScale() [2/3]

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

Returns a scale matrix.

§ MatrixScale() [3/3]

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

Returns a scale matrix.

Member Data Documentation

§ data

double data[4]
inherited

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