Scribus
Open source desktop publishing at your fingertips
Geom::Matrix Class Reference

#include <matrix.h>

Public Member Functions

 Matrix (Matrix const &m)
 
 Matrix (Coord c0, Coord c1, Coord c2, Coord c3, Coord c4, Coord c5)
 
Matrixoperator= (Matrix const &m)
 
Coord operator[] (unsigned const i) const
 
Coordoperator[] (unsigned const i)
 
Point xAxis () const
 
Point yAxis () const
 
Point translation () const
 
void setXAxis (Point const &vec)
 
void setYAxis (Point const &vec)
 
void setTranslation (Point const &loc)
 
double expansionX () const
 
double expansionY () const
 
void setExpansionX (double val)
 
void setExpansionY (double val)
 
void setIdentity ()
 
bool isIdentity (Coord eps=EPSILON) const
 
bool isTranslation (Coord eps=EPSILON) const
 
bool isRotation (double eps=EPSILON) const
 
bool isScale (double eps=EPSILON) const
 
bool isUniformScale (double eps=EPSILON) const
 
bool onlyScaleAndTranslation (double eps=EPSILON) const
 
bool flips () const
 
Matrix without_translation () const
 
Matrix inverse () const
 
Coord det () const
 
Coord descrim2 () const
 
Coord descrim () const
 

Detailed Description

The Matrix class.

For purposes of multiplication, points should be thought of as row vectors

$(p_X p_Y 1)$

to be right-multiplied by transformation matrices of the form

\[ \left[ \begin{array}{ccc} c_0&c_1&0 \\ c_2&c_3&0 \\ c_4&c_5&1 \end{array} \right] \]

(so the columns of the matrix correspond to the columns (elements) of the result, and the rows of the matrix correspond to columns (elements) of the "input").

Member Function Documentation

Geom::Coord Geom::Matrix::descrim ( ) const

Calculates the descriminant of the Matrix.

Geom::Coord Geom::Matrix::descrim2 ( ) const

Calculates the scalar of the descriminant of the Matrix. This is simply the absolute value of the determinant.

Geom::Coord Geom::Matrix::det ( ) const

Calculates the determinant of a Matrix.

double Geom::Matrix::expansionX ( ) const

Calculates the amount of x-scaling imparted by the Matrix. This is the scaling applied to the original x-axis region. It is {not} the overall x-scaling of the transformation. Equivalent to L2(m.xAxis())

double Geom::Matrix::expansionY ( ) const

Calculates the amount of y-scaling imparted by the Matrix. This is the scaling applied before the other transformations. It is {not} the overall y-scaling of the transformation. Equivalent to L2(m.yAxis())

Matrix Geom::Matrix::inverse ( ) const

Attempts to calculate the inverse of a matrix. This is a Matrix such that m * m.inverse() is very near (hopefully < epsilon difference) the identity Matrix. {The Identity Matrix is returned if the matrix has no inverse.}

Returns
The inverse of the Matrix if defined, otherwise the Identity Matrix.
bool Geom::Matrix::isRotation ( double  eps = EPSILON) const

Answers the question "Does this matrix perform a rotation, and \em{only} a rotation?"

Parameters
epsan epsilon value defaulting to EPSILON
Returns
A bool representing yes/no.
bool Geom::Matrix::isScale ( double  eps = EPSILON) const

Answers the question "Does this matrix perform a scale, and \em{only} a Scale?"

Parameters
epsan epsilon value defaulting to EPSILON
Returns
A bool representing yes/no.
bool Geom::Matrix::isTranslation ( Coord  eps = EPSILON) const

Answers the question "Does this matrix perform a translation, and \em{only} a translation?"

Parameters
epsan epsilon value defaulting to EPSILON
Returns
A bool representing yes/no.
bool Geom::Matrix::isUniformScale ( double  eps = EPSILON) const

Answers the question "Does this matrix perform a uniform scale, and \em{only} a uniform scale?"

Parameters
epsan epsilon value defaulting to EPSILON
Returns
A bool representing yes/no.
void Geom::Matrix::setIdentity ( )

Sets this matrix to be the Identity Matrix.

void Geom::Matrix::setTranslation ( Point const &  loc)

Sets the translation imparted by the Matrix.

Point Geom::Matrix::translation ( ) const

Gets the translation imparted by the Matrix.

Matrix Geom::Matrix::without_translation ( ) const

Returns the Scale/Rotate/skew part of the matrix without the translation part.


The documentation for this class was generated from the following files: