LCOV - code coverage report
Current view: top level - include/basegfx/matrix - b3dhommatrix.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 4 4 100.0 %
Date: 2015-06-13 12:38:46 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_BASEGFX_MATRIX_B3DHOMMATRIX_HXX
      21             : #define INCLUDED_BASEGFX_MATRIX_B3DHOMMATRIX_HXX
      22             : 
      23             : #include <sal/types.h>
      24             : #include <basegfx/point/b3dpoint.hxx>
      25             : #include <basegfx/vector/b3dvector.hxx>
      26             : #include <o3tl/cow_wrapper.hxx>
      27             : #include <basegfx/basegfxdllapi.h>
      28             : 
      29             : namespace basegfx
      30             : {
      31             :     class B3DTuple;
      32             :     class Impl3DHomMatrix;
      33             : 
      34             :     class BASEGFX_DLLPUBLIC B3DHomMatrix
      35             :     {
      36             :     public:
      37             :         typedef o3tl::cow_wrapper< Impl3DHomMatrix > ImplType;
      38             : 
      39             :     private:
      40             :         ImplType                                     mpImpl;
      41             : 
      42             :     public:
      43             :         B3DHomMatrix();
      44             :         B3DHomMatrix(const B3DHomMatrix& rMat);
      45             :         ~B3DHomMatrix();
      46             : 
      47             :         double get(sal_uInt16 nRow, sal_uInt16 nColumn) const;
      48             :         void set(sal_uInt16 nRow, sal_uInt16 nColumn, double fValue);
      49             : 
      50             :         // test if last line is default to see if last line needs to be
      51             :         // involved in calculations
      52             :         bool isLastLineDefault() const;
      53             : 
      54             :         bool isIdentity() const;
      55             :         /// Reset to the identity matrix
      56             :         void identity();
      57             : 
      58             :         /// Invert the matrix (if possible)
      59             :         bool invert();
      60             : 
      61             :         /// Calc the matrix determinant
      62             :         double determinant() const;
      63             : 
      64             :         /// Rotation
      65             :         void rotate(double fAngleX,double fAngleY,double fAngleZ);
      66             : 
      67             :         /// Translation
      68             :         void translate(double fX, double fY, double fZ);
      69             : 
      70             :         /// Scaling
      71             :         void scale(double fX, double fY, double fZ);
      72             : 
      73             :         // Shearing-Matrices
      74             :         void shearXY(double fSx, double fSy);
      75             :         void shearXZ(double fSx, double fSz);
      76             : 
      77             :         // Projection matrices, used for converting between eye and
      78             :         // clip coordinates
      79             :         void frustum(double fLeft = -1.0, double fRight = 1.0,
      80             :             double fBottom = -1.0, double fTop = 1.0,
      81             :             double fNear = 0.001, double fFar = 1.0);
      82             : 
      83             :         void ortho(double fLeft = -1.0, double fRight = 1.0,
      84             :             double fBottom = -1.0, double fTop = 1.0,
      85             :             double fNear = 0.0, double fFar = 1.0);
      86             : 
      87             :         // build orientation matrix
      88             :         void orientation(
      89             :             const B3DPoint& rVRP = B3DPoint(0.0,0.0,1.0),
      90             :             B3DVector aVPN = B3DVector(0.0,0.0,1.0),
      91             :             B3DVector aVUV = B3DVector(0.0,1.0,0.0));
      92             : 
      93             :         // addition, subtraction
      94             :         B3DHomMatrix& operator+=(const B3DHomMatrix& rMat);
      95             :         B3DHomMatrix& operator-=(const B3DHomMatrix& rMat);
      96             : 
      97             :         // comparison
      98             :         bool operator==(const B3DHomMatrix& rMat) const;
      99             :         bool operator!=(const B3DHomMatrix& rMat) const;
     100             : 
     101             :         // multiplication, division by constant value
     102             :         B3DHomMatrix& operator*=(double fValue);
     103             :         B3DHomMatrix& operator/=(double fValue);
     104             : 
     105             :         // matrix multiplication (from the left)
     106             :         B3DHomMatrix& operator*=(const B3DHomMatrix& rMat);
     107             : 
     108             :         // assignment operator
     109             :         B3DHomMatrix& operator=(const B3DHomMatrix& rMat);
     110             : 
     111             :         // decomposition
     112             :         bool decompose(B3DTuple& rScale, B3DTuple& rTranslate, B3DTuple& rRotate, B3DTuple& rShear) const;
     113             :     };
     114             : 
     115             :     // addition, subtraction
     116             :     inline B3DHomMatrix operator+(const B3DHomMatrix& rMatA, const B3DHomMatrix& rMatB)
     117             :     {
     118             :         B3DHomMatrix aSum(rMatA);
     119             :         aSum += rMatB;
     120             :         return aSum;
     121             :     }
     122             : 
     123             :     inline B3DHomMatrix operator-(const B3DHomMatrix& rMatA, const B3DHomMatrix& rMatB)
     124             :     {
     125             :         B3DHomMatrix aDiv(rMatA);
     126             :         aDiv -= rMatB;
     127             :         return aDiv;
     128             :     }
     129             : 
     130             :     // multiplication, division by constant value
     131             :     inline B3DHomMatrix operator*(const B3DHomMatrix& rMat, double fValue)
     132             :     {
     133             :         B3DHomMatrix aNew(rMat);
     134             :         aNew *= fValue;
     135             :         return aNew;
     136             :     }
     137             : 
     138             :     inline B3DHomMatrix operator/(const B3DHomMatrix& rMat, double fValue)
     139             :     {
     140             :         B3DHomMatrix aNew(rMat);
     141             :         aNew *= 1.0 / fValue;
     142             :         return aNew;
     143             :     }
     144             : 
     145      110340 :     inline B3DHomMatrix operator*(const B3DHomMatrix& rMatA, const B3DHomMatrix& rMatB)
     146             :     {
     147      110340 :         B3DHomMatrix aMul(rMatB);
     148      110340 :         aMul *= rMatA;
     149      110340 :         return aMul;
     150             :     }
     151             : } // end of namespace basegfx
     152             : 
     153             : #endif // INCLUDED_BASEGFX_MATRIX_B3DHOMMATRIX_HXX
     154             : 
     155             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11