Sourceforge.net - The VCF's Project Host
   The VCF Website Home   |   Online Discussion Forums   |   Sourceforge.net Project Page   

VCF::Matrix2D Class Reference

The Matrix2D is used for transforming 2D shapes or images. More...

#include <vcf/GraphicsKit/Matrix2D.h>

Inheritance diagram for VCF::Matrix2D:

VCF::Object List of all members.

Public Types

enum  MatrixElementIndex {
  mei00 = 0, mei01 = 1, mei02 = 2, mei10 = 3,
  mei11 = 4, mei12 = 5, mei20 = 6, mei21 = 7,
  mei22 = 8
}
 Use the values of these enums to reference a value of the matrix. More...

Public Member Functions

 Matrix2D ()
 Matrix2D (const Matrix2D &matrix)
 Matrix2D (const agg::trans_affine &matrix)
virtual ~Matrix2D ()
void transpose (Matrix2D *dest)
 transposes the matrix
void reflect (const bool &reflectX, const bool &reflectY)
 creates a reflection matrix
void rotate (const double &theta)
 creates a rotation matrix
void shear (const double &shearX, const double &shearY)
 creates a shear matrix
void scale (const double &scaleX, const double &scaleY)
 creates a scale matrix |0|scaleX|0| |scaleY|0|0| |0|0|1|
void identity ()
 Creates an identity matrix |1|0|0| |0|1|0| |0|0|1| .
Matrix2Dmultiply (const Matrix2D &rhs)
 multiply m1 X this instance
Matrix2Dpremultiply (const Matrix2D &rhs)
void translate (const double &transX, const double &transY)
 creates a translation matrix
void invert ()
 inverts the current matrix
Point apply (Point *point) const
void apply (double &x, double &y) const
Rect apply (Rect *rect) const
virtual bool isEqual (Object *object) const
 is the current matrix instance equal to the object passed in ? where hopefully the object is a pointer to a Matrix2D instance.
virtual void copy (Object *source)
 copy the data in the Matrix2D source into the current instance.
Matrix2Doperator= (const Matrix2D &matrix)
Matrix2Doperator= (const agg::trans_affine &matrix)
 operator agg::trans_affine () const
bool operator== (const Matrix2D &matrix) const
double & operator[] (MatrixElementIndex index)
 subscript operator overload for conveniently accessing the matrix elements.
double operator[] (MatrixElementIndex index) const
Matrix2Doperator *= (const Matrix2D &rhs)
Matrix2Doperator/= (const Matrix2D &rhs)
Matrix2D operator * (const Matrix2D &rhs)
Matrix2D operator/ (const Matrix2D &rhs)
Matrix2D operator~ () const
bool isIdentity (double epsilon=MatrixEpsilon) const
double getRotation () const
double getScaleX () const
double getScaleY () const
double getTranslateX () const
double getTranslateY () const
double getShearX () const
double getShearY () const
void getScale (double &x, double &y) const
void getTranslation (double &x, double &y) const
void getShear (double &x, double &y) const

Static Public Member Functions

static Matrix2D rotation (const double &theta)
static Matrix2D translation (const double &x, const double &y)
static Matrix2D scaling (const double &sx, const double &sy)
static Matrix2D shearing (const double &shx, const double &shy)

Protected Attributes

double matrix_ [3][3]

Detailed Description

The Matrix2D is used for transforming 2D shapes or images.

This class is intended to represent an affine matrix made up of a 3X3 array of doubles.

See also:
GraphicsContext

Path


Member Enumeration Documentation

enum VCF::Matrix2D::MatrixElementIndex
 

Use the values of these enums to reference a value of the matrix.

Enumerator:
mei00  references element at 0,0 in matrix
mei01  references element at 0,1 in matrix
mei02  references element at 0,2 in matrix
mei10  references element at 1,0 in matrix
mei11  references element at 1,1 in matrix
mei12  references element at 1,2 in matrix
mei20  references element at 2,0 in matrix
mei21  references element at 2,1 in matrix
mei22  references element at 2,2 in matrix


Constructor & Destructor Documentation

VCF::Matrix2D::Matrix2D  ) 
 

VCF::Matrix2D::Matrix2D const Matrix2D matrix  ) 
 

VCF::Matrix2D::Matrix2D const agg::trans_affine &  matrix  ) 
 

virtual VCF::Matrix2D::~Matrix2D  )  [virtual]
 


Member Function Documentation

Rect VCF::Matrix2D::apply Rect rect  )  const
 

void VCF::Matrix2D::apply double &  x,
double &  y
const
 

Point VCF::Matrix2D::apply Point point  )  const
 

virtual void VCF::Matrix2D::copy Object source  )  [virtual]
 

copy the data in the Matrix2D source into the current instance.

Reimplemented from VCF::Object.

double VCF::Matrix2D::getRotation  )  const
 

void VCF::Matrix2D::getScale double &  x,
double &  y
const
 

double VCF::Matrix2D::getScaleX  )  const
 

double VCF::Matrix2D::getScaleY  )  const
 

void VCF::Matrix2D::getShear double &  x,
double &  y
const
 

double VCF::Matrix2D::getShearX  )  const
 

double VCF::Matrix2D::getShearY  )  const
 

double VCF::Matrix2D::getTranslateX  )  const
 

double VCF::Matrix2D::getTranslateY  )  const
 

void VCF::Matrix2D::getTranslation double &  x,
double &  y
const
 

void VCF::Matrix2D::identity  ) 
 

Creates an identity matrix |1|0|0| |0|1|0| |0|0|1| .

void VCF::Matrix2D::invert  ) 
 

inverts the current matrix

virtual bool VCF::Matrix2D::isEqual Object object  )  const [virtual]
 

is the current matrix instance equal to the object passed in ? where hopefully the object is a pointer to a Matrix2D instance.

Returns:
bool true if the two Matrix2D's matrix_ data is equal in value, otherwise false

Reimplemented from VCF::Object.

bool VCF::Matrix2D::isIdentity double  epsilon = MatrixEpsilon  )  const
 

Matrix2D& VCF::Matrix2D::multiply const Matrix2D rhs  ) 
 

multiply m1 X this instance

Returns:
Matrix2D a reference to the current instance

Matrix2D VCF::Matrix2D::operator * const Matrix2D rhs  )  [inline]
 

Matrix2D& VCF::Matrix2D::operator *= const Matrix2D rhs  )  [inline]
 

VCF::Matrix2D::operator agg::trans_affine  )  const
 

Matrix2D VCF::Matrix2D::operator/ const Matrix2D rhs  )  [inline]
 

Matrix2D& VCF::Matrix2D::operator/= const Matrix2D rhs  )  [inline]
 

Matrix2D& VCF::Matrix2D::operator= const agg::trans_affine &  matrix  ) 
 

Matrix2D& VCF::Matrix2D::operator= const Matrix2D matrix  ) 
 

bool VCF::Matrix2D::operator== const Matrix2D matrix  )  const
 

double VCF::Matrix2D::operator[] MatrixElementIndex  index  )  const
 

double& VCF::Matrix2D::operator[] MatrixElementIndex  index  ) 
 

subscript operator overload for conveniently accessing the matrix elements.

Access is provided by using the defines above, where M_00 represents the double value at matrix_[0][0], and M_01 represents the double value at matrix_[0][1], and so forth.

Matrix2D VCF::Matrix2D::operator~  )  const [inline]
 

Matrix2D& VCF::Matrix2D::premultiply const Matrix2D rhs  )  [inline]
 

void VCF::Matrix2D::reflect const bool &  reflectX,
const bool &  reflectY
 

creates a reflection matrix

Parameters:
bool reflectX whether or not to reflect on the X axis
bool reflectY whether or not to reflect on the Y axis

void VCF::Matrix2D::rotate const double &  theta  ) 
 

creates a rotation matrix

Parameters:
double the angle of the newly created rotation matrix from 0.0..360.0

static Matrix2D VCF::Matrix2D::rotation const double &  theta  )  [inline, static]
 

void VCF::Matrix2D::scale const double &  scaleX,
const double &  scaleY
 

creates a scale matrix |0|scaleX|0| |scaleY|0|0| |0|0|1|

Parameters:
double scaleX the amount of scaling to apply along the x axis
double scaleY the amount of scaling to apply along the Y axis

static Matrix2D VCF::Matrix2D::scaling const double &  sx,
const double &  sy
[inline, static]
 

void VCF::Matrix2D::shear const double &  shearX,
const double &  shearY
 

creates a shear matrix

Parameters:
double shearX the amount to shear along the X axis ranges in degrees from 0.0...360.0
double shearY the amount to shear along the Y axis ranges in degrees from 0.0...360.0

static Matrix2D VCF::Matrix2D::shearing const double &  shx,
const double &  shy
[inline, static]
 

void VCF::Matrix2D::translate const double &  transX,
const double &  transY
 

creates a translation matrix

Parameters:
double transX the amount to translate along the X axis
double transY the amount to translate along the Y axis

static Matrix2D VCF::Matrix2D::translation const double &  x,
const double &  y
[inline, static]
 

void VCF::Matrix2D::transpose Matrix2D dest  ) 
 

transposes the matrix

Parameters:
Matrix2D dest the matrix that is transposed by this matrix.


Member Data Documentation

double VCF::Matrix2D::matrix_[3][3] [protected]
 


The documentation for this class was generated from the following file:
   Comments or Suggestions?    License Information