diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-26 00:29:37 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-26 00:29:37 +0000 |
commit | 2785103a6bd4de55bd26d79e34d0fdd4b329a73a (patch) | |
tree | c2738b1095bfdb263da27bc1391403d829522a14 /krita/core/kis_perspective_math.h | |
parent | f008adb5a77e094eaf6abf3fc0f36958e66896a5 (diff) | |
download | koffice-2785103a6bd4de55bd26d79e34d0fdd4b329a73a.tar.gz koffice-2785103a6bd4de55bd26d79e34d0fdd4b329a73a.zip |
Remove krita* in preparation for name switch from Krita to Chalk
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238361 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'krita/core/kis_perspective_math.h')
-rw-r--r-- | krita/core/kis_perspective_math.h | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/krita/core/kis_perspective_math.h b/krita/core/kis_perspective_math.h deleted file mode 100644 index b7cbdb79..00000000 --- a/krita/core/kis_perspective_math.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * This file is part of Krita - * - * Copyright (c) 2006 Cyrille Berger <cberger@cberger.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef _KIS_PERSPECTVE_MATH_H_ -#define _KIS_PERSPECTVE_MATH_H_ - -#include "kis_point.h" - -class TQRect; - -class KisPerspectiveMath { - private: - KisPerspectiveMath() { } - public: - static double* computeMatrixTransfo( const KisPoint& topLeft1, const KisPoint& topRight1, const KisPoint& bottomLeft1, const KisPoint& bottomRight1 , const KisPoint& topLeft2, const KisPoint& topRight2, const KisPoint& bottomLeft2, const KisPoint& bottomRight2); - static double* computeMatrixTransfoToPerspective(const KisPoint& topLeft, const KisPoint& topRight, const KisPoint& bottomLeft, const KisPoint& bottomRight, const TQRect& r); - static double* computeMatrixTransfoFromPerspective(const TQRect& r, const KisPoint& topLeft, const KisPoint& topRight, const KisPoint& bottomLeft, const KisPoint& bottomRight); - struct LineEquation { - // y = a*x + b - double a, b; - }; - /// TODO: get ride of this in 2.0 - inline static KisPoint matProd(const double (&m)[3][3], const KisPoint& p) - { - double s = ( p.x() * m[2][0] + p.y() * m[2][1] + 1.0); - s = (s == 0.) ? 1. : 1./s; - return KisPoint( (p.x() * m[0][0] + p.y() * m[0][1] + m[0][2] ) * s, - (p.x() * m[1][0] + p.y() * m[1][1] + m[1][2] ) * s ); - } - static inline LineEquation computeLineEquation(const KisPoint* p1, const KisPoint* p2) - { - LineEquation eq; - double x1 = p1->x(); double x2 = p2->x(); - if( fabs(x1 - x2) < 0.000001 ) - { - x1 += 0.0001; // Introduce a small perturbation - } - eq.a = (p2->y() - p1->y()) / (double)( x2 - x1 ); - eq.b = -eq.a * x1 + p1->y(); - return eq; - } - static inline KisPoint computeIntersection(const LineEquation& d1, const LineEquation& d2) - { - double a1 = d1.a; double a2 = d2.a; - if( fabs(a1 - a2) < 0.000001 ) - { - a1 += 0.0001; // Introduce a small perturbation - } - double x = (d1.b - d2.b) / (a2 - a1); - return KisPoint(x, a2 * x + d2.b); - } -}; - -#endif |