LibreOffice Module basegfx (master) 1
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
basegfx::B2DHomMatrix Class Reference

#include <b2dhommatrix.hxx>

Public Member Functions

constexpr B2DHomMatrix ()=default
 
constexpr B2DHomMatrix (double f_0x0, double f_0x1, double f_0x2, double f_1x0, double f_1x1, double f_1x2)
 constructor to allow setting all needed values for a 3x2 matrix at once. More...
 
double a () const
 
double b () const
 
double c () const
 
double d () const
 
double e () const
 
double f () const
 
double get (sal_uInt16 nRow, sal_uInt16 nColumn) const
 
void set (sal_uInt16 nRow, sal_uInt16 nColumn, double fValue)
 
void set3x2 (double f_0x0, double f_0x1, double f_0x2, double f_1x0, double f_1x1, double f_1x2)
 allow setting all needed values for a 3x2 matrix in one call. More...
 
bool isIdentity () const
 
void identity ()
 
bool isInvertible () const
 
bool invert ()
 
void rotate (double fRadiant)
 
void translate (double fX, double fY)
 
void translate (const B2DTuple &rTuple)
 
void scale (double fX, double fY)
 
void scale (const B2DTuple &rTuple)
 
void shearX (double fSx)
 
void shearY (double fSy)
 
bool operator== (const B2DHomMatrix &rMat) const
 
bool operator!= (const B2DHomMatrix &rMat) const
 
B2DHomMatrixoperator*= (const B2DHomMatrix &rMat)
 
bool decompose (B2DTuple &rScale, B2DTuple &rTranslate, double &rRotate, double &rShearX) const
 Help routine to decompose given homogen 3x3 matrix to components. More...
 

Static Public Member Functions

static B2DHomMatrix abcdef (double da, double db, double dc, double dd, double de, double df)
 Convenience creator for declaration of the matrix that is commonly used by web standards (SVG, CSS, HTML). More...
 

Private Member Functions

void computeAdjoint (double(&dst)[6]) const
 
double computeDeterminant (double(&dst)[6]) const
 
void doMulMatrix (const B2DHomMatrix &rMat)
 

Private Attributes

std::array< std::array< double, 3 >, 2 > mfValues
 

Detailed Description

Definition at line 35 of file b2dhommatrix.hxx.

Constructor & Destructor Documentation

◆ B2DHomMatrix() [1/2]

constexpr basegfx::B2DHomMatrix::B2DHomMatrix ( )
constexprdefault

◆ B2DHomMatrix() [2/2]

constexpr basegfx::B2DHomMatrix::B2DHomMatrix ( double  f_0x0,
double  f_0x1,
double  f_0x2,
double  f_1x0,
double  f_1x1,
double  f_1x2 
)
inlineconstexpr

constructor to allow setting all needed values for a 3x2 matrix at once.

The parameter f_0x1 e.g. is the same as using set(0, 1, f)

Definition at line 49 of file b2dhommatrix.hxx.

Member Function Documentation

◆ a()

double basegfx::B2DHomMatrix::a ( ) const
inline

Definition at line 74 of file b2dhommatrix.hxx.

References get().

Referenced by doMulMatrix(), identity(), isIdentity(), and operator==().

◆ abcdef()

static B2DHomMatrix basegfx::B2DHomMatrix::abcdef ( double  da,
double  db,
double  dc,
double  dd,
double  de,
double  df 
)
inlinestatic

Convenience creator for declaration of the matrix that is commonly used by web standards (SVG, CSS, HTML).

Values a,b,c,d,e,f represent the following values in the matrix: [a,c,e] [a,c,e] [b,d,f] or [b,d,f] [0,0,1]

Definition at line 68 of file b2dhommatrix.hxx.

◆ b()

double basegfx::B2DHomMatrix::b ( ) const
inline

Definition at line 76 of file b2dhommatrix.hxx.

References get().

Referenced by doMulMatrix(), identity(), isIdentity(), and operator==().

◆ c()

double basegfx::B2DHomMatrix::c ( ) const
inline

Definition at line 78 of file b2dhommatrix.hxx.

References get().

Referenced by doMulMatrix().

◆ computeAdjoint()

void basegfx::B2DHomMatrix::computeAdjoint ( double(&)  dst[6]) const
private

Definition at line 109 of file b2dhommatrix.cxx.

References get().

Referenced by invert(), and isInvertible().

◆ computeDeterminant()

double basegfx::B2DHomMatrix::computeDeterminant ( double(&)  dst[6]) const
private

Definition at line 120 of file b2dhommatrix.cxx.

References mfValues.

Referenced by invert(), and isInvertible().

◆ d()

double basegfx::B2DHomMatrix::d ( ) const
inline

Definition at line 80 of file b2dhommatrix.hxx.

References get().

◆ decompose()

bool basegfx::B2DHomMatrix::decompose ( B2DTuple rScale,
B2DTuple rTranslate,
double &  rRotate,
double &  rShearX 
) const

Help routine to decompose given homogen 3x3 matrix to components.

Decomposition.

A correction of the components is done to avoid inaccuracies.

See basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix() for the opposite, to compose a homogen 3x3 matrix from components.

New, optimized version with local shearX detection. Old version (keeping below, is working well, too) used the 3D matrix decomposition when shear was used. Keeping old version as comment below since it may get necessary to add the determinant() test from there here, too.

Definition at line 280 of file b2dhommatrix.cxx.

References basegfx::B2DVector::cross(), basegfx::fTools::equalZero(), get(), basegfx::B2DVector::getLength(), basegfx::Tuple2D< TYPE >::getX(), basegfx::Tuple2D< TYPE >::getY(), basegfx::B2DVector::scalar(), basegfx::Tuple2D< TYPE >::setX(), and basegfx::Tuple2D< TYPE >::setY().

Referenced by basegfx::utils::B2DHomMatrixBufferedOnDemandDecompose::impCheckDecompose().

◆ doMulMatrix()

void basegfx::B2DHomMatrix::doMulMatrix ( const B2DHomMatrix rMat)
private

Definition at line 145 of file b2dhommatrix.cxx.

References a(), b(), c(), and mfValues.

Referenced by operator*=(), rotate(), scale(), shearX(), shearY(), and translate().

◆ e()

double basegfx::B2DHomMatrix::e ( ) const
inline

Definition at line 82 of file b2dhommatrix.hxx.

References get().

◆ f()

double basegfx::B2DHomMatrix::f ( ) const
inline

Definition at line 84 of file b2dhommatrix.hxx.

References get().

◆ get()

double basegfx::B2DHomMatrix::get ( sal_uInt16  nRow,
sal_uInt16  nColumn 
) const
inline

◆ identity()

void basegfx::B2DHomMatrix::identity ( )

◆ invert()

bool basegfx::B2DHomMatrix::invert ( )

◆ isIdentity()

bool basegfx::B2DHomMatrix::isIdentity ( ) const

◆ isInvertible()

bool basegfx::B2DHomMatrix::isInvertible ( ) const

◆ operator!=()

bool basegfx::B2DHomMatrix::operator!= ( const B2DHomMatrix rMat) const

Definition at line 185 of file b2dhommatrix.cxx.

◆ operator*=()

B2DHomMatrix & basegfx::B2DHomMatrix::operator*= ( const B2DHomMatrix rMat)

Definition at line 125 of file b2dhommatrix.cxx.

References doMulMatrix(), and isIdentity().

◆ operator==()

bool basegfx::B2DHomMatrix::operator== ( const B2DHomMatrix rMat) const

Definition at line 165 of file b2dhommatrix.cxx.

References a(), b(), and mfValues.

◆ rotate()

void basegfx::B2DHomMatrix::rotate ( double  fRadiant)

◆ scale() [1/2]

void basegfx::B2DHomMatrix::scale ( const B2DTuple rTuple)

◆ scale() [2/2]

void basegfx::B2DHomMatrix::scale ( double  fX,
double  fY 
)

◆ set()

void basegfx::B2DHomMatrix::set ( sal_uInt16  nRow,
sal_uInt16  nColumn,
double  fValue 
)
inline

◆ set3x2()

void basegfx::B2DHomMatrix::set3x2 ( double  f_0x0,
double  f_0x1,
double  f_0x2,
double  f_1x0,
double  f_1x1,
double  f_1x2 
)

allow setting all needed values for a 3x2 matrix in one call.

The parameter f_0x1 e.g. is the same as using set(0, 1, f)

Definition at line 31 of file b2dhommatrix.cxx.

References mfValues.

Referenced by basegfx::utils::createRotateAroundPoint().

◆ shearX()

void basegfx::B2DHomMatrix::shearX ( double  fSx)

Definition at line 247 of file b2dhommatrix.cxx.

References doMulMatrix(), basegfx::fTools::equalZero(), and set().

◆ shearY()

void basegfx::B2DHomMatrix::shearY ( double  fSy)

Definition at line 260 of file b2dhommatrix.cxx.

References doMulMatrix(), basegfx::fTools::equalZero(), and set().

◆ translate() [1/2]

void basegfx::B2DHomMatrix::translate ( const B2DTuple rTuple)

◆ translate() [2/2]

void basegfx::B2DHomMatrix::translate ( double  fX,
double  fY 
)

Member Data Documentation

◆ mfValues

std::array<std::array<double, 3>, 2> basegfx::B2DHomMatrix::mfValues
private
Initial value:
{
std::array<double, 3>{ 1.0, 0.0, 0.0 },
std::array<double, 3>{ 0.0, 1.0, 0.0 } }

Definition at line 39 of file b2dhommatrix.hxx.

Referenced by computeDeterminant(), doMulMatrix(), identity(), invert(), operator==(), and set3x2().


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