summaryrefslogtreecommitdiff
path: root/basegfx/inc/basegfx/matrix
diff options
context:
space:
mode:
Diffstat (limited to 'basegfx/inc/basegfx/matrix')
-rw-r--r--basegfx/inc/basegfx/matrix/b2dhommatrix.hxx192
-rw-r--r--basegfx/inc/basegfx/matrix/b3dhommatrix.hxx206
2 files changed, 193 insertions, 205 deletions
diff --git a/basegfx/inc/basegfx/matrix/b2dhommatrix.hxx b/basegfx/inc/basegfx/matrix/b2dhommatrix.hxx
index 7ff8dfec5ed3..f574e062f5c1 100644
--- a/basegfx/inc/basegfx/matrix/b2dhommatrix.hxx
+++ b/basegfx/inc/basegfx/matrix/b2dhommatrix.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dhommatrix.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: thb $ $Date: 2003-11-12 12:12:40 $
+ * last change: $Author: aw $ $Date: 2003-11-28 11:17:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -68,127 +68,121 @@
namespace basegfx
{
- namespace tuple
- {
- // predeclaration
- class B2DTuple;
- } // end of namespace tuple
+ // predeclaration
+ class B2DTuple;
+
+ // forward declaration
+ class Impl2DHomMatrix;
- namespace matrix
+ class B2DHomMatrix
{
- // forward declaration
- class Impl2DHomMatrix;
+ private:
+ Impl2DHomMatrix* mpM;
- class B2DHomMatrix
- {
- private:
- Impl2DHomMatrix* mpM;
+ void implPrepareChange();
- void implPrepareChange();
+ public:
+ B2DHomMatrix();
+ B2DHomMatrix(const B2DHomMatrix& rMat);
+ ~B2DHomMatrix();
- public:
- B2DHomMatrix();
- B2DHomMatrix(const B2DHomMatrix& rMat);
- ~B2DHomMatrix();
+ double get(sal_uInt16 nRow, sal_uInt16 nColumn) const;
+ void set(sal_uInt16 nRow, sal_uInt16 nColumn, double fValue);
- double get(sal_uInt16 nRow, sal_uInt16 nColumn) const;
- void set(sal_uInt16 nRow, sal_uInt16 nColumn, double fValue);
+ // Auf Einheitsmatrix zuruecksetzen
+ sal_Bool isIdentity() const;
+ void identity();
- // Auf Einheitsmatrix zuruecksetzen
- sal_Bool isIdentity() const;
- void identity();
+ // Invertierung
+ sal_Bool isInvertible() const;
+ sal_Bool invert();
- // Invertierung
- sal_Bool isInvertible() const;
- sal_Bool invert();
+ // Normalisierung
+ sal_Bool isNormalized() const;
+ void normalize();
- // Normalisierung
- sal_Bool isNormalized() const;
- void normalize();
+ // Determinante
+ double determinant() const;
- // Determinante
- double determinant() const;
+ // Trace
+ double trace() const;
- // Trace
- double trace() const;
+ // Transpose
+ void transpose();
- // Transpose
- void transpose();
+ // Rotation
+ void rotate(double fRadiant);
- // Rotation
- void rotate(double fRadiant);
+ // Translation
+ void translate(double fX, double fY);
- // Translation
- void translate(double fX, double fY);
+ // Skalierung
+ void scale(double fX, double fY);
- // Skalierung
- void scale(double fX, double fY);
+ // Shearing-Matrices
+ void shearX(double fSx);
+ void shearY(double fSy);
- // Shearing-Matrices
- void shearX(double fSx);
- void shearY(double fSy);
+ // Addition, Subtraktion
+ B2DHomMatrix& operator+=(const B2DHomMatrix& rMat);
+ B2DHomMatrix& operator-=(const B2DHomMatrix& rMat);
- // Addition, Subtraktion
- B2DHomMatrix& operator+=(const B2DHomMatrix& rMat);
- B2DHomMatrix& operator-=(const B2DHomMatrix& rMat);
+ // Vergleichsoperatoren
+ sal_Bool operator==(const B2DHomMatrix& rMat) const;
+ sal_Bool operator!=(const B2DHomMatrix& rMat) const;
- // Vergleichsoperatoren
- sal_Bool operator==(const B2DHomMatrix& rMat) const;
- sal_Bool operator!=(const B2DHomMatrix& rMat) const;
+ // Multiplikation, Division mit Konstante
+ B2DHomMatrix& operator*=(double fValue);
+ B2DHomMatrix& operator/=(double fValue);
- // Multiplikation, Division mit Konstante
- B2DHomMatrix& operator*=(double fValue);
- B2DHomMatrix& operator/=(double fValue);
+ // Matritzenmultiplikation von links auf die lokale
+ B2DHomMatrix& operator*=(const B2DHomMatrix& rMat);
- // Matritzenmultiplikation von links auf die lokale
- B2DHomMatrix& operator*=(const B2DHomMatrix& rMat);
+ // assignment operator
+ B2DHomMatrix& operator=(const B2DHomMatrix& rMat);
- // assignment operator
- B2DHomMatrix& operator=(const B2DHomMatrix& rMat);
+ // Help routine to decompose given homogen 3x3 matrix to components. A correction of
+ // the components is done to avoid inaccuracies.
+ // Zerlegung
+ sal_Bool decompose(B2DTuple& rScale, B2DTuple& rTranslate, double& rRotate, double& rShearX) const;
+ };
- // Help routine to decompose given homogen 3x3 matrix to components. A correction of
- // the components is done to avoid inaccuracies.
- // Zerlegung
- sal_Bool decompose(tuple::B2DTuple& rScale, tuple::B2DTuple& rTranslate, double& rRotate, double& rShearX) const;
- };
+ // Addition, Subtraktion
+ inline B2DHomMatrix operator+(const B2DHomMatrix& rMatA, const B2DHomMatrix& rMatB)
+ {
+ B2DHomMatrix aSum(rMatA);
+ aSum += rMatB;
+ return aSum;
+ }
- // Addition, Subtraktion
- inline B2DHomMatrix operator+(const B2DHomMatrix& rMatA, const B2DHomMatrix& rMatB)
- {
- B2DHomMatrix aSum(rMatA);
- aSum += rMatB;
- return aSum;
- }
-
- inline B2DHomMatrix operator-(const B2DHomMatrix& rMatA, const B2DHomMatrix& rMatB)
- {
- B2DHomMatrix aDiv(rMatA);
- aDiv -= rMatB;
- return aDiv;
- }
+ inline B2DHomMatrix operator-(const B2DHomMatrix& rMatA, const B2DHomMatrix& rMatB)
+ {
+ B2DHomMatrix aDiv(rMatA);
+ aDiv -= rMatB;
+ return aDiv;
+ }
- // Multiplikation, Division mit Konstante
- inline B2DHomMatrix operator*(const B2DHomMatrix& rMat, double fValue)
- {
- B2DHomMatrix aNew(rMat);
- aNew *= fValue;
- return aNew;
- }
-
- inline B2DHomMatrix operator/(const B2DHomMatrix& rMat, double fValue)
- {
- B2DHomMatrix aNew(rMat);
- aNew *= 1.0 / fValue;
- return aNew;
- }
-
- inline B2DHomMatrix operator*(const B2DHomMatrix& rMatA, const B2DHomMatrix& rMatB)
- {
- B2DHomMatrix aMul(rMatB);
- aMul *= rMatA;
- return aMul;
- }
- } // end of namespace matrix
+ // Multiplikation, Division mit Konstante
+ inline B2DHomMatrix operator*(const B2DHomMatrix& rMat, double fValue)
+ {
+ B2DHomMatrix aNew(rMat);
+ aNew *= fValue;
+ return aNew;
+ }
+
+ inline B2DHomMatrix operator/(const B2DHomMatrix& rMat, double fValue)
+ {
+ B2DHomMatrix aNew(rMat);
+ aNew *= 1.0 / fValue;
+ return aNew;
+ }
+
+ inline B2DHomMatrix operator*(const B2DHomMatrix& rMatA, const B2DHomMatrix& rMatB)
+ {
+ B2DHomMatrix aMul(rMatB);
+ aMul *= rMatA;
+ return aMul;
+ }
} // end of namespace basegfx
#endif // _BGFX_MATRIX_B2DHOMMATRIX_HXX
diff --git a/basegfx/inc/basegfx/matrix/b3dhommatrix.hxx b/basegfx/inc/basegfx/matrix/b3dhommatrix.hxx
index f16b81c930d7..e2751a76c3cd 100644
--- a/basegfx/inc/basegfx/matrix/b3dhommatrix.hxx
+++ b/basegfx/inc/basegfx/matrix/b3dhommatrix.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b3dhommatrix.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: thb $ $Date: 2003-11-12 12:12:40 $
+ * last change: $Author: aw $ $Date: 2003-11-28 11:17:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -68,136 +68,130 @@
namespace basegfx
{
- namespace tuple
- {
- // predeclaration
- class B3DTuple;
- } // end of namespace tuple
+ // predeclaration
+ class B3DTuple;
+
+ // forward declaration
+ class Impl3DHomMatrix;
- namespace matrix
+ class B3DHomMatrix
{
- // forward declaration
- class Impl3DHomMatrix;
+ private:
+ Impl3DHomMatrix* mpM;
- class B3DHomMatrix
- {
- private:
- Impl3DHomMatrix* mpM;
+ void implPrepareChange();
- void implPrepareChange();
+ public:
+ B3DHomMatrix();
+ B3DHomMatrix(const B3DHomMatrix& rMat);
+ ~B3DHomMatrix();
- public:
- B3DHomMatrix();
- B3DHomMatrix(const B3DHomMatrix& rMat);
- ~B3DHomMatrix();
+ double get(sal_uInt16 nRow, sal_uInt16 nColumn) const;
+ void set(sal_uInt16 nRow, sal_uInt16 nColumn, double fValue);
- double get(sal_uInt16 nRow, sal_uInt16 nColumn) const;
- void set(sal_uInt16 nRow, sal_uInt16 nColumn, double fValue);
+ sal_Bool isIdentity() const;
+ /// Reset to the identity matrix
+ void identity();
- sal_Bool isIdentity() const;
- /// Reset to the identity matrix
- void identity();
+ sal_Bool isInvertible() const;
+ /// Invert the matrix (if possible)
+ sal_Bool invert();
- sal_Bool isInvertible() const;
- /// Invert the matrix (if possible)
- sal_Bool invert();
+ sal_Bool isNormalized() const;
+ /// Normalize (i.e. force w=1) the matrix
+ void normalize();
- sal_Bool isNormalized() const;
- /// Normalize (i.e. force w=1) the matrix
- void normalize();
+ /// Calc the matrix determinant
+ double determinant() const;
- /// Calc the matrix determinant
- double determinant() const;
+ /// Calc the matrix trace
+ double trace() const;
- /// Calc the matrix trace
- double trace() const;
+ /// Transpose the matrix
+ void transpose();
- /// Transpose the matrix
- void transpose();
+ /// Rotation
+ void rotate(double fAngleX,double fAngleY,double fAngleZ);
- /// Rotation
- void rotate(double fAngleX,double fAngleY,double fAngleZ);
+ /// Translation
+ void translate(double fX, double fY, double fZ);
- /// Translation
- void translate(double fX, double fY, double fZ);
+ /// Scaling
+ void scale(double fX, double fY, double fZ);
- /// Scaling
- void scale(double fX, double fY, double fZ);
+ // Shearing-Matrices
+ void shearXY(double fSx, double fSy);
+ void shearYZ(double fSy, double fSz);
+ void shearXZ(double fSx, double fSz);
- // Shearing-Matrices
- void shearXY(double fSx, double fSy);
- void shearYZ(double fSy, double fSz);
- void shearXZ(double fSx, double fSz);
+ // Projection matrices, used for converting between eye and
+ // clip coordinates
+ void frustum(double fLeft = -1.0, double fRight = 1.0,
+ double fBottom = -1.0, double fTop = 1.0,
+ double fNear = 0.001, double fFar = 1.0);
- // Projection matrices, used for converting between eye and
- // clip coordinates
- void frustum(double fLeft = -1.0, double fRight = 1.0,
- double fBottom = -1.0, double fTop = 1.0,
- double fNear = 0.001, double fFar = 1.0);
+ void ortho(double fLeft = -1.0, double fRight = 1.0,
+ double fBottom = -1.0, double fTop = 1.0,
+ double fNear = 0.0, double fFar = 1.0);
- void ortho(double fLeft = -1.0, double fRight = 1.0,
- double fBottom = -1.0, double fTop = 1.0,
- double fNear = 0.0, double fFar = 1.0);
+ // addition, subtraction
+ B3DHomMatrix& operator+=(const B3DHomMatrix& rMat);
+ B3DHomMatrix& operator-=(const B3DHomMatrix& rMat);
- // addition, subtraction
- B3DHomMatrix& operator+=(const B3DHomMatrix& rMat);
- B3DHomMatrix& operator-=(const B3DHomMatrix& rMat);
+ // comparison
+ sal_Bool operator==(const B3DHomMatrix& rMat) const;
+ sal_Bool operator!=(const B3DHomMatrix& rMat) const;
- // comparison
- sal_Bool operator==(const B3DHomMatrix& rMat) const;
- sal_Bool operator!=(const B3DHomMatrix& rMat) const;
+ // multiplication, division by constant value
+ B3DHomMatrix& operator*=(double fValue);
+ B3DHomMatrix& operator/=(double fValue);
- // multiplication, division by constant value
- B3DHomMatrix& operator*=(double fValue);
- B3DHomMatrix& operator/=(double fValue);
+ // matrix multiplication (from the left)
+ B3DHomMatrix& operator*=(const B3DHomMatrix& rMat);
- // matrix multiplication (from the left)
- B3DHomMatrix& operator*=(const B3DHomMatrix& rMat);
+ // assignment operator
+ B3DHomMatrix& operator=(const B3DHomMatrix& rMat);
- // assignment operator
- B3DHomMatrix& operator=(const B3DHomMatrix& rMat);
+ // decomposition
+ sal_Bool decompose(B3DTuple& rScale, B3DTuple& rTranslate, B3DTuple& rRotate, B3DTuple& rShear) const;
+ };
- // decomposition
- sal_Bool decompose(tuple::B3DTuple& rScale, tuple::B3DTuple& rTranslate, tuple::B3DTuple& rRotate, tuple::B3DTuple& rShear) const;
- };
+ // addition, subtraction
+ inline B3DHomMatrix operator+(const B3DHomMatrix& rMatA, const B3DHomMatrix& rMatB)
+ {
+ B3DHomMatrix aSum(rMatA);
+ aSum += rMatB;
+ return aSum;
+ }
- // addition, subtraction
- inline B3DHomMatrix operator+(const B3DHomMatrix& rMatA, const B3DHomMatrix& rMatB)
- {
- B3DHomMatrix aSum(rMatA);
- aSum += rMatB;
- return aSum;
- }
-
- inline B3DHomMatrix operator-(const B3DHomMatrix& rMatA, const B3DHomMatrix& rMatB)
- {
- B3DHomMatrix aDiv(rMatA);
- aDiv -= rMatB;
- return aDiv;
- }
+ inline B3DHomMatrix operator-(const B3DHomMatrix& rMatA, const B3DHomMatrix& rMatB)
+ {
+ B3DHomMatrix aDiv(rMatA);
+ aDiv -= rMatB;
+ return aDiv;
+ }
- // multiplication, division by constant value
- inline B3DHomMatrix operator*(const B3DHomMatrix& rMat, double fValue)
- {
- B3DHomMatrix aNew(rMat);
- aNew *= fValue;
- return aNew;
- }
-
- inline B3DHomMatrix operator/(const B3DHomMatrix& rMat, double fValue)
- {
- B3DHomMatrix aNew(rMat);
- aNew *= 1.0 / fValue;
- return aNew;
- }
-
- inline B3DHomMatrix operator*(const B3DHomMatrix& rMatA, const B3DHomMatrix& rMatB)
- {
- B3DHomMatrix aMul(rMatB);
- aMul *= rMatA;
- return aMul;
- }
- } // end of namespace matrix
+ // multiplication, division by constant value
+ inline B3DHomMatrix operator*(const B3DHomMatrix& rMat, double fValue)
+ {
+ B3DHomMatrix aNew(rMat);
+ aNew *= fValue;
+ return aNew;
+ }
+
+ inline B3DHomMatrix operator/(const B3DHomMatrix& rMat, double fValue)
+ {
+ B3DHomMatrix aNew(rMat);
+ aNew *= 1.0 / fValue;
+ return aNew;
+ }
+
+ inline B3DHomMatrix operator*(const B3DHomMatrix& rMatA, const B3DHomMatrix& rMatB)
+ {
+ B3DHomMatrix aMul(rMatB);
+ aMul *= rMatA;
+ return aMul;
+ }
} // end of namespace basegfx
#endif // _BGFX_MATRIX_B3DHOMMATRIX_HXX