Visit Cem Yuksel's web site

Files

Class List

Class Members

Class Hierarchy

cyMatrix2f Class Reference

#include <cyMatrix2.h>

List of all members.


Detailed Description

2x2 matrix class.

Its data stores 4-value array of column-major matrix elements. You can use cyMatrix2f with cyPoint2f to transform 2D points. Both post-multiplication and pre-multiplication are supported.


Public Member Functions

Constructors
 cyMatrix2f ()
 Default constructor.
 cyMatrix2f (const cyMatrix2f &matrix)
 Copy constructor.
Set & Get Methods
void Zero ()
 Set all the values as zero.
void Set (const float *array)
 Set Matrix using an array of 4 values.
void Set (const cyPoint2f &x, const cyPoint2f &y)
 Set Matrix using x,y,z vectors and coordinate center.
void SetIdentity ()
 Converts the matrix to an identity matrix.
void SetRotation (float theta)
 Set a rotation matrix by angle theta.
void SetRotation (float cosTheta, float sinTheta)
 Set a rotation matrix by cos and sin of angle theta.
cyPoint2f GetRow (int row) const
 Set all the values as zero.
void GetRow (int row, cyPoint2f &p) const
 Set all the values as zero.
void GetRow (int row, float *array) const
 Set all the values as zero.
cyPoint2f GetColumn (int col) const
 Set all the values as zero.
void GetColumn (int col, cyPoint2f &p) const
 Set all the values as zero.
void GetColumn (int col, float *array) const
 Set all the values as zero.
Overloaded Operators
const cyMatrix2foperator= (const cyMatrix2f &)
 assign matrix
bool operator== (const cyMatrix2f &) const
 compare equal
bool operator!= (const cyMatrix2f &right) const
 compare not equal
float & operator() (int row, int column)
 subscript operator
float & operator[] (int i)
 subscript operator
const float & operator() (int row, int column) const
 constant subscript operator
const float & operator[] (int i) const
 constant subscript operator
cyMatrix2f operator- () const
 negative matrix
cyMatrix2f operator+ (const cyMatrix2f &) const
 add two Matrices
cyMatrix2f operator- (const cyMatrix2f &) const
 subtract one cyMatrix2f from an other
cyMatrix2f operator * (const cyMatrix2f &) const
 multiply a matrix with an other
cyMatrix2f operator+ (const float) const
 add a value to a matrix
cyMatrix2f operator- (const float) const
 subtract a value from a matrix
cyMatrix2f operator * (const float) const
 multiple matrix by a value
cyMatrix2f operator/ (const float) const
 divide matrix by a value;
cyPoint2f operator * (const cyPoint2f &p) const
 assign matrix
void operator+= (const cyMatrix2f &)
 add two Matrices modify this
void operator-= (const cyMatrix2f &)
 subtract one cyMatrix2f from an other modify this matrix
void operator *= (const cyMatrix2f &)
 multiply a matrix with an other modify this matrix
void operator+= (const float)
 add a value to a matrix modify this
void operator-= (const float)
 subtract a value from a matrix modify this matrix
void operator *= (const float)
 multiply a matrix with a value modify this matrix
void operator/= (const float)
 divide the matrix by a value modify the this matrix
Other Public Methods
void SetTranspose ()
 Transpose this matrix.
cyMatrix2f Transpose () const
 return Transpose of this matrix
void Invert ()
 Invert this matrix.
void GetInverse (cyMatrix2f &inverse)
 Get the inverse of this matrix.
cyMatrix2f GetInverse ()
 Get the inverse of this matrix.

Public Attributes

float data [4]
 elements of the matrix are column-major

Friends

cyMatrix2f operator+ (const float, const cyMatrix2f &)
 add a value to a matrix
cyMatrix2f operator- (const float, const cyMatrix2f &)
 subtract the matrix from a value
cyMatrix2f operator * (const float, const cyMatrix2f &)
 multiple matrix by a value
cyMatrix2f Inverse (cyMatrix2f &m)
 return the inverse of the matrix
cyPoint2f operator * (const cyPoint2f &, const cyMatrix2f &)
 pre-multiply with a 3D point

Visit Cem Yuksel's website!