diff options
author | Armin Weiss <aw@openoffice.org> | 2003-11-05 11:25:58 +0000 |
---|---|---|
committer | Armin Weiss <aw@openoffice.org> | 2003-11-05 11:25:58 +0000 |
commit | c3663a687ccc9365b2b4eb4a3950b8d94c2d6ea7 (patch) | |
tree | c47ce5e59d718d5f772121000a356ef523662b17 /basegfx/source | |
parent | 571971699571e0baf9710ddf076ebf27aebb548d (diff) |
Added PolyPolygonTools, Added PolygonTool functionality, changed bool to sal_Bool
Diffstat (limited to 'basegfx/source')
-rw-r--r-- | basegfx/source/curve/b2dcubicbezier.cxx | 14 | ||||
-rw-r--r-- | basegfx/source/curve/b2dquadraticbezier.cxx | 14 | ||||
-rw-r--r-- | basegfx/source/inc/PolygonPoint.hxx | 50 | ||||
-rw-r--r-- | basegfx/source/inc/hommatrixtemplate.hxx | 48 | ||||
-rw-r--r-- | basegfx/source/inc/polygontemplate.hxx | 50 | ||||
-rw-r--r-- | basegfx/source/matrix/b2dhommatrix.cxx | 36 | ||||
-rw-r--r-- | basegfx/source/matrix/b3dhommatrix.cxx | 34 | ||||
-rw-r--r-- | basegfx/source/point/b2dhompoint.cxx | 10 | ||||
-rw-r--r-- | basegfx/source/polygon/b2dpolygon.cxx | 176 | ||||
-rw-r--r-- | basegfx/source/polygon/b2dpolygontools.cxx | 422 | ||||
-rw-r--r-- | basegfx/source/polygon/b2dpolypolygon.cxx | 112 | ||||
-rw-r--r-- | basegfx/source/polygon/makefile.mk | 11 | ||||
-rw-r--r-- | basegfx/source/tuple/b2dtuple.cxx | 12 | ||||
-rw-r--r-- | basegfx/source/vector/b2dvector.cxx | 16 | ||||
-rw-r--r-- | basegfx/source/workbench/bezierclip.cxx | 56 | ||||
-rw-r--r-- | basegfx/source/workbench/bezierclip.hxx | 12 | ||||
-rw-r--r-- | basegfx/source/workbench/convexhull.cxx | 10 | ||||
-rw-r--r-- | basegfx/source/workbench/gauss.hxx | 30 |
18 files changed, 867 insertions, 246 deletions
diff --git a/basegfx/source/curve/b2dcubicbezier.cxx b/basegfx/source/curve/b2dcubicbezier.cxx index 8573e5e06934..05ac36f5bb86 100644 --- a/basegfx/source/curve/b2dcubicbezier.cxx +++ b/basegfx/source/curve/b2dcubicbezier.cxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dcubicbezier.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2003-10-31 10:13:54 $ + * last change: $Author: aw $ $Date: 2003-11-05 12:25:47 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -118,7 +118,7 @@ namespace basegfx } // compare operators - bool B2DCubicBezier::operator==(const B2DCubicBezier& rBezier) const + sal_Bool B2DCubicBezier::operator==(const B2DCubicBezier& rBezier) const { return ( maStartPoint == rBezier.maStartPoint @@ -128,7 +128,7 @@ namespace basegfx ); } - bool B2DCubicBezier::operator!=(const B2DCubicBezier& rBezier) const + sal_Bool B2DCubicBezier::operator!=(const B2DCubicBezier& rBezier) const { return ( maStartPoint != rBezier.maStartPoint @@ -139,14 +139,14 @@ namespace basegfx } // test if vectors are used - bool B2DCubicBezier::isBezier() const + sal_Bool B2DCubicBezier::isBezier() const { if(maControlPointA != maStartPoint || maControlPointB != maEndPoint) { - return true; + return sal_True; } - return false; + return sal_False; } void B2DCubicBezier::testAndSolveTrivialBezier() diff --git a/basegfx/source/curve/b2dquadraticbezier.cxx b/basegfx/source/curve/b2dquadraticbezier.cxx index 71f5d55a28f0..a22fc9778090 100644 --- a/basegfx/source/curve/b2dquadraticbezier.cxx +++ b/basegfx/source/curve/b2dquadraticbezier.cxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dquadraticbezier.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2003-10-31 10:13:54 $ + * last change: $Author: aw $ $Date: 2003-11-05 12:25:48 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -116,7 +116,7 @@ namespace basegfx } // compare operators - bool B2DQuadraticBezier::operator==(const B2DQuadraticBezier& rBezier) const + sal_Bool B2DQuadraticBezier::operator==(const B2DQuadraticBezier& rBezier) const { return ( maStartPoint == rBezier.maStartPoint @@ -125,7 +125,7 @@ namespace basegfx ); } - bool B2DQuadraticBezier::operator!=(const B2DQuadraticBezier& rBezier) const + sal_Bool B2DQuadraticBezier::operator!=(const B2DQuadraticBezier& rBezier) const { return ( maStartPoint != rBezier.maStartPoint @@ -135,13 +135,13 @@ namespace basegfx } // test if control vector is used - bool B2DQuadraticBezier::isBezier() const + sal_Bool B2DQuadraticBezier::isBezier() const { // if control vector is empty, bezier is not used if(maControlPoint == maStartPoint || maControlPoint == maEndPoint) - return false; + return sal_False; - return true; + return sal_True; } } // end of namespace curve } // end of namespace basegfx diff --git a/basegfx/source/inc/PolygonPoint.hxx b/basegfx/source/inc/PolygonPoint.hxx index 37a228c1a2a6..5e38fb0dca73 100644 --- a/basegfx/source/inc/PolygonPoint.hxx +++ b/basegfx/source/inc/PolygonPoint.hxx @@ -2,9 +2,9 @@ * * $RCSfile: PolygonPoint.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: thb $ $Date: 2003-08-20 16:56:48 $ + * last change: $Author: aw $ $Date: 2003-11-05 12:25:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -91,7 +91,7 @@ public: maPoint = rValue; } - bool operator==(const SimplePointEntry& rEntry) const + sal_Bool operator==(const SimplePointEntry& rEntry) const { return (maPoint == rEntry.maPoint); } @@ -137,14 +137,14 @@ public: maForward = rValue; } - bool isBezierNeeded() + sal_Bool isBezierNeeded() { if(maBackward != Vector::getEmptyVector() || maForward != Vector::getEmptyVector()) - return true; - return false; + return sal_True; + return sal_False; } - bool operator==(const SimpleBezierEntry& rEntry) const + sal_Bool operator==(const SimpleBezierEntry& rEntry) const { return ((maBackward == rEntry.maBackward) && (maForward == rEntry.maForward)); } @@ -181,17 +181,17 @@ template < class Point, class Vector > class PolygonPointList } public: - bool isBezier() const + sal_Bool isBezier() const { - return bool(mnBezierCount); + return sal_Bool(mnBezierCount); } - bool isClosed() const + sal_Bool isClosed() const { - return bool(mbIsClosed); + return sal_Bool(mbIsClosed); } - void setClosed(bool bNew) + void setClosed(sal_Bool bNew) { mbIsClosed = bNew; } @@ -204,7 +204,7 @@ public: PolygonPointList() : mnBezierCount(0L), mpVectors(0L), - mbIsClosed(false) + mbIsClosed(sal_False) { // complete initialization with defaults } @@ -276,27 +276,27 @@ public: } } - bool isEqual(const PolygonPointList& rPointList) const + sal_Bool isEqual(const PolygonPointList& rPointList) const { // same point count? if(maPoints.size() != rPointList.maPoints.size()) - return false; + return sal_False; // if zero points the polys are equal if(!maPoints.size()) - return true; + return sal_True; // if bezier count used it needs to be equal if(mnBezierCount != rPointList.mnBezierCount) - return false; + return sal_False; // compare point content if(maPoints != rPointList.maPoints) - return false; + return sal_False; // beziercounts are equal: if it's zero, we are done if(!mnBezierCount) - return true; + return sal_True; // beziercounts are equal and not zero; compare them DBG_ASSERT(0L != mpVectors, "Error: Bezier list needs to exist here(!)"); @@ -328,9 +328,9 @@ public: if(mpVectors) { LocalSimpleBezierEntry& rDest = (*mpVectors)[nIndex]; - bool bBezierNeededBefore(rDest.isBezierNeeded()); + sal_Bool bBezierNeededBefore(rDest.isBezierNeeded()); ((*mpVectors)[nIndex]).setBackwardVector(rValue); - bool bBezierNeededAfter(rDest.isBezierNeeded()); + sal_Bool bBezierNeededAfter(rDest.isBezierNeeded()); if(bBezierNeededBefore != bBezierNeededAfter) { @@ -342,7 +342,7 @@ public: } else { - bool bEmptyVector(rValue == Vector::getEmptyVector()); + sal_Bool bEmptyVector(rValue == Vector::getEmptyVector()); if(bEmptyVector) return; @@ -366,9 +366,9 @@ public: if(mpVectors) { LocalSimpleBezierEntry& rDest = (*mpVectors)[nIndex]; - bool bBezierNeededBefore(rDest.isBezierNeeded()); + sal_Bool bBezierNeededBefore(rDest.isBezierNeeded()); ((*mpVectors)[nIndex]).setForwardVector(rValue); - bool bBezierNeededAfter(rDest.isBezierNeeded()); + sal_Bool bBezierNeededAfter(rDest.isBezierNeeded()); if(bBezierNeededBefore != bBezierNeededAfter) { @@ -380,7 +380,7 @@ public: } else { - bool bEmptyVector(rValue == Vector::getEmptyVector()); + sal_Bool bEmptyVector(rValue == Vector::getEmptyVector()); if(bEmptyVector) return; diff --git a/basegfx/source/inc/hommatrixtemplate.hxx b/basegfx/source/inc/hommatrixtemplate.hxx index 4b4f4416cab1..c1c81288c04e 100644 --- a/basegfx/source/inc/hommatrixtemplate.hxx +++ b/basegfx/source/inc/hommatrixtemplate.hxx @@ -2,9 +2,9 @@ * * $RCSfile: hommatrixtemplate.hxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: aw $ $Date: 2003-10-31 10:13:55 $ + * last change: $Author: aw $ $Date: 2003-11-05 12:25:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -124,10 +124,10 @@ template < int _RowSize > class ImplHomMatrixTemplate public: // Is last line used? - bool isLastLineDefault() const + sal_Bool isLastLineDefault() const { if(!mpLine) - return true; + return sal_True; for(sal_uInt16 a(0); a < RowSize; a++) { @@ -136,7 +136,7 @@ public: if(!::basegfx::numeric::fTools::equal(fDefault, fLineValue)) { - return false; + return sal_False; } } @@ -144,7 +144,7 @@ public: delete ((ImplHomMatrixTemplate< RowSize >*)this)->mpLine; ((ImplHomMatrixTemplate< RowSize >*)this)->mpLine = 0L; - return true; + return sal_True; } // This constructor is only used form the static identity matrix, thus @@ -233,7 +233,7 @@ public: { if(mpLine) { - bool bNecessary(false); + sal_Bool bNecessary(sal_False); for(sal_uInt16 a(0);!bNecessary && a < RowSize; a++) { @@ -242,7 +242,7 @@ public: if(!::basegfx::numeric::fTools::equal(fDefault, fLineValue)) { - bNecessary = true; + bNecessary = sal_True; } } @@ -255,7 +255,7 @@ public: } // Left-upper decompositon - bool ludcmp(sal_uInt16 nIndex[], sal_Int16& nParity) + sal_Bool ludcmp(sal_uInt16 nIndex[], sal_Int16& nParity) { double fBig, fSum, fDum; double fStorage[RowSize]; @@ -281,7 +281,7 @@ public: if(::basegfx::numeric::fTools::equalZero(fBig)) { - return false; + return sal_False; } fStorage[a] = 1.0 / fBig; @@ -343,7 +343,7 @@ public: if(::basegfx::numeric::fTools::equalZero(fValBB)) { - return false; + return sal_False; } if(b != (RowSize - 1)) @@ -357,7 +357,7 @@ public: } } - return true; + return sal_True; } void lubksb(const sal_uInt16 nIndex[], double fRow[]) const @@ -405,7 +405,7 @@ public: } } - bool isIdentity() const + sal_Bool isIdentity() const { // last line needs no testing if not existing const sal_uInt16 nMaxLine = (mpLine) ? RowSize : (RowSize - 1); @@ -419,15 +419,15 @@ public: if(!::basegfx::numeric::fTools::equal(fDefault, fValueAB)) { - return false; + return sal_False; } } } - return true; + return sal_True; } - bool isInvertible() const + sal_Bool isInvertible() const { ImplHomMatrixTemplate aWork(*this); sal_uInt16 nIndex[RowSize]; @@ -436,26 +436,26 @@ public: return aWork.ludcmp(nIndex, nParity); } - bool isNormalized() const + sal_Bool isNormalized() const { if(!mpLine) - return true; + return sal_True; const double fHomValue(get((RowSize - 1), (RowSize - 1))); if(::basegfx::numeric::fTools::equalZero(fHomValue)) { - return true; + return sal_True; } const double fOne(1.0); if(::basegfx::numeric::fTools::equal(fOne, fHomValue)) { - return true; + return sal_True; } - return false; + return sal_False; } void doInvert(const ImplHomMatrixTemplate& rWork, const sal_uInt16 nIndex[]) @@ -618,7 +618,7 @@ public: testLastLine(); } - bool isEqual(const ImplHomMatrixTemplate& rMat) + sal_Bool isEqual(const ImplHomMatrixTemplate& rMat) { const sal_uInt16 nMaxLine = (mpLine || rMat.mpLine) ? RowSize : (RowSize - 1); @@ -631,12 +631,12 @@ public: if(!::basegfx::numeric::fTools::equal(fValueA, fValueB)) { - return false; + return sal_False; } } } - return true; + return sal_True; } }; diff --git a/basegfx/source/inc/polygontemplate.hxx b/basegfx/source/inc/polygontemplate.hxx index 27203d952442..c3dda878e052 100644 --- a/basegfx/source/inc/polygontemplate.hxx +++ b/basegfx/source/inc/polygontemplate.hxx @@ -2,9 +2,9 @@ * * $RCSfile: polygontemplate.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: thb $ $Date: 2003-08-20 16:56:48 $ + * last change: $Author: aw $ $Date: 2003-11-05 12:25:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -91,7 +91,7 @@ public: maPoint = rValue; } - bool operator==(const ImplSimplePointEntry& rEntry) const + sal_Bool operator==(const ImplSimplePointEntry& rEntry) const { return (maPoint == rEntry.maPoint); } @@ -137,14 +137,14 @@ public: maForward = rValue; } - bool isBezierNeeded() + sal_Bool isBezierNeeded() { if(!maBackward.equalZero() || !maForward.equalZero()) - return true; - return false; + return sal_True; + return sal_False; } - bool operator==(const ImplSimpleBezierEntry& rEntry) const + sal_Bool operator==(const ImplSimpleBezierEntry& rEntry) const { return ((maBackward == rEntry.maBackward) && (maForward == rEntry.maForward)); } @@ -181,17 +181,17 @@ template < class Point, class Vector > class ImplPolygonTemplate } public: - bool isBezier() const + sal_Bool isBezier() const { - return bool(mnBezierCount); + return sal_Bool(mnBezierCount); } - bool isClosed() const + sal_Bool isClosed() const { - return bool(mbIsClosed); + return sal_Bool(mbIsClosed); } - void setClosed(bool bNew) + void setClosed(sal_Bool bNew) { mbIsClosed = bNew; } @@ -204,7 +204,7 @@ public: ImplPolygonTemplate() : mnBezierCount(0L), mpVectors(0L), - mbIsClosed(false) + mbIsClosed(sal_False) { // complete initialization with defaults } @@ -276,27 +276,27 @@ public: } } - bool isEqual(const ImplPolygonTemplate& rPointList) const + sal_Bool isEqual(const ImplPolygonTemplate& rPointList) const { // same point count? if(maPoints.size() != rPointList.maPoints.size()) - return false; + return sal_False; // if zero points the polys are equal if(!maPoints.size()) - return true; + return sal_True; // if bezier count used it needs to be equal if(mnBezierCount != rPointList.mnBezierCount) - return false; + return sal_False; // compare point content if(maPoints != rPointList.maPoints) - return false; + return sal_False; // beziercounts are equal: if it's zero, we are done if(!mnBezierCount) - return true; + return sal_True; // beziercounts are equal and not zero; compare them DBG_ASSERT(0L != mpVectors, "Error: Bezier list needs to exist here(!)"); @@ -328,9 +328,9 @@ public: if(mpVectors) { LocalImplSimpleBezierEntry& rDest = (*mpVectors)[nIndex]; - bool bBezierNeededBefore(rDest.isBezierNeeded()); + sal_Bool bBezierNeededBefore(rDest.isBezierNeeded()); ((*mpVectors)[nIndex]).setBackwardVector(rValue); - bool bBezierNeededAfter(rDest.isBezierNeeded()); + sal_Bool bBezierNeededAfter(rDest.isBezierNeeded()); if(bBezierNeededBefore != bBezierNeededAfter) { @@ -342,7 +342,7 @@ public: } else { - bool bEmptyVector(rValue.equalZero()); + sal_Bool bEmptyVector(rValue.equalZero()); if(bEmptyVector) return; @@ -366,9 +366,9 @@ public: if(mpVectors) { LocalImplSimpleBezierEntry& rDest = (*mpVectors)[nIndex]; - bool bBezierNeededBefore(rDest.isBezierNeeded()); + sal_Bool bBezierNeededBefore(rDest.isBezierNeeded()); ((*mpVectors)[nIndex]).setForwardVector(rValue); - bool bBezierNeededAfter(rDest.isBezierNeeded()); + sal_Bool bBezierNeededAfter(rDest.isBezierNeeded()); if(bBezierNeededBefore != bBezierNeededAfter) { @@ -380,7 +380,7 @@ public: } else { - bool bEmptyVector(rValue.equalZero()); + sal_Bool bEmptyVector(rValue.equalZero()); if(bEmptyVector) return; diff --git a/basegfx/source/matrix/b2dhommatrix.cxx b/basegfx/source/matrix/b2dhommatrix.cxx index 005dac082664..f9b4b3e48554 100644 --- a/basegfx/source/matrix/b2dhommatrix.cxx +++ b/basegfx/source/matrix/b2dhommatrix.cxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dhommatrix.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2003-10-31 10:13:55 $ + * last change: $Author: aw $ $Date: 2003-11-05 12:25:51 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -146,10 +146,10 @@ namespace basegfx mpM->set(nRow, nColumn, fValue); } - bool B2DHomMatrix::isIdentity() const + sal_Bool B2DHomMatrix::isIdentity() const { if(mpM == &get2DIdentityMatrix()) - return true; + return sal_True; return mpM->isIdentity(); } @@ -165,12 +165,12 @@ namespace basegfx mpM->incRefCount(); } - bool B2DHomMatrix::isInvertible() const + sal_Bool B2DHomMatrix::isInvertible() const { return mpM->isInvertible(); } - bool B2DHomMatrix::invert() + sal_Bool B2DHomMatrix::invert() { Impl2DHomMatrix aWork(*mpM); sal_uInt16* pIndex = new sal_uInt16[mpM->getEdgeLength()]; @@ -182,14 +182,14 @@ namespace basegfx mpM->doInvert(aWork, pIndex); delete pIndex; - return true; + return sal_True; } delete pIndex; - return false; + return sal_False; } - bool B2DHomMatrix::isNormalized() const + sal_Bool B2DHomMatrix::isNormalized() const { return mpM->isNormalized(); } @@ -272,18 +272,18 @@ namespace basegfx return *this; } - bool B2DHomMatrix::operator==(const B2DHomMatrix& rMat) const + sal_Bool B2DHomMatrix::operator==(const B2DHomMatrix& rMat) const { if(mpM == rMat.mpM) - return true; + return sal_True; return mpM->isEqual(*rMat.mpM); } - bool B2DHomMatrix::operator!=(const B2DHomMatrix& rMat) const + sal_Bool B2DHomMatrix::operator!=(const B2DHomMatrix& rMat) const { if(mpM == rMat.mpM) - return false; + return sal_False; return !mpM->isEqual(*rMat.mpM); } @@ -367,15 +367,15 @@ namespace basegfx } // Decomposition - bool B2DHomMatrix::decompose(tuple::B2DTuple& rScale, tuple::B2DTuple& rTranslate, double& rRotate, double& rShearX) const + sal_Bool B2DHomMatrix::decompose(tuple::B2DTuple& rScale, tuple::B2DTuple& rTranslate, double& rRotate, double& rShearX) const { // when perspective is used, decompose is not made here if(!mpM->isLastLineDefault()) - return false; + return sal_False; // If determinant is zero, decomposition is not possible if(0.0 == mpM->doDeterminant()) - return false; + return sal_False; // copy 2x2 matrix and translate vector to 3x3 matrix ::basegfx::matrix::B3DHomMatrix a3DHomMat; @@ -405,10 +405,10 @@ namespace basegfx rTranslate.setX(r3DTranslate.getX()); rTranslate.setY(r3DTranslate.getY()); - return true; + return sal_True; } - return false; + return sal_False; } } // end of namespace matrix } // end of namespace basegfx diff --git a/basegfx/source/matrix/b3dhommatrix.cxx b/basegfx/source/matrix/b3dhommatrix.cxx index 939e952f796a..232ff46c7c77 100644 --- a/basegfx/source/matrix/b3dhommatrix.cxx +++ b/basegfx/source/matrix/b3dhommatrix.cxx @@ -2,9 +2,9 @@ * * $RCSfile: b3dhommatrix.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2003-10-31 10:13:55 $ + * last change: $Author: aw $ $Date: 2003-11-05 12:25:52 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -138,10 +138,10 @@ namespace basegfx mpM->set(nRow, nColumn, fValue); } - bool B3DHomMatrix::isIdentity() const + sal_Bool B3DHomMatrix::isIdentity() const { if(mpM == &get3DIdentityMatrix()) - return true; + return sal_True; return mpM->isIdentity(); } @@ -157,12 +157,12 @@ namespace basegfx mpM->incRefCount(); } - bool B3DHomMatrix::isInvertible() const + sal_Bool B3DHomMatrix::isInvertible() const { return mpM->isInvertible(); } - bool B3DHomMatrix::invert() + sal_Bool B3DHomMatrix::invert() { Impl3DHomMatrix aWork(*mpM); sal_uInt16* pIndex = new sal_uInt16[mpM->getEdgeLength()]; @@ -174,14 +174,14 @@ namespace basegfx mpM->doInvert(aWork, pIndex); delete pIndex; - return true; + return sal_True; } delete pIndex; - return false; + return sal_False; } - bool B3DHomMatrix::isNormalized() const + sal_Bool B3DHomMatrix::isNormalized() const { return mpM->isNormalized(); } @@ -264,18 +264,18 @@ namespace basegfx return *this; } - bool B3DHomMatrix::operator==(const B3DHomMatrix& rMat) const + sal_Bool B3DHomMatrix::operator==(const B3DHomMatrix& rMat) const { if(mpM == rMat.mpM) - return true; + return sal_True; return mpM->isEqual(*rMat.mpM); } - bool B3DHomMatrix::operator!=(const B3DHomMatrix& rMat) const + sal_Bool B3DHomMatrix::operator!=(const B3DHomMatrix& rMat) const { if(mpM == rMat.mpM) - return false; + return sal_False; return !mpM->isEqual(*rMat.mpM); } @@ -497,15 +497,15 @@ namespace basegfx mpM = new Impl3DHomMatrix(aOrthoMat); } - bool B3DHomMatrix::decompose(tuple::B3DTuple& rScale, tuple::B3DTuple& rTranslate, tuple::B3DTuple& rRotate, tuple::B3DTuple& rShear) const + sal_Bool B3DHomMatrix::decompose(tuple::B3DTuple& rScale, tuple::B3DTuple& rTranslate, tuple::B3DTuple& rRotate, tuple::B3DTuple& rShear) const { // when perspective is used, decompose is not made here if(!mpM->isLastLineDefault()) - return false; + return sal_False; // If determinant is zero, decomposition is not possible if(0.0 == mpM->doDeterminant()) - return false; + return sal_False; // isolate translation rTranslate.setX(mpM->get(0, 3)); @@ -631,7 +631,7 @@ namespace basegfx // corrcet rotate values rRotate.correctValues(); - return true; + return sal_True; } } // end of namespace matrix } // end of namespace basegfx diff --git a/basegfx/source/point/b2dhompoint.cxx b/basegfx/source/point/b2dhompoint.cxx index 573fcc38cd6c..75a5b5f0e782 100644 --- a/basegfx/source/point/b2dhompoint.cxx +++ b/basegfx/source/point/b2dhompoint.cxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dhompoint.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2003-10-31 10:13:56 $ + * last change: $Author: aw $ $Date: 2003-11-05 12:25:53 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -75,7 +75,7 @@ namespace basegfx { namespace point { - bool B2DHomPoint::implIsHomogenized() const + sal_Bool B2DHomPoint::implIsHomogenized() const { const double fOne(1.0); return ::basegfx::numeric::fTools::equal(fOne, mfW); @@ -183,13 +183,13 @@ namespace basegfx return *this; } - bool B2DHomPoint::operator==( const B2DHomPoint& rPnt ) const + sal_Bool B2DHomPoint::operator==( const B2DHomPoint& rPnt ) const { implTestAndHomogenize(); return (maTuple == rPnt.maTuple); } - bool B2DHomPoint::operator!=( const B2DHomPoint& rPnt ) const + sal_Bool B2DHomPoint::operator!=( const B2DHomPoint& rPnt ) const { implTestAndHomogenize(); return (maTuple != rPnt.maTuple); diff --git a/basegfx/source/polygon/b2dpolygon.cxx b/basegfx/source/polygon/b2dpolygon.cxx index a9ddb6e90534..3d532cdf478d 100644 --- a/basegfx/source/polygon/b2dpolygon.cxx +++ b/basegfx/source/polygon/b2dpolygon.cxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dpolygon.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2003-10-31 10:13:58 $ + * last change: $Author: aw $ $Date: 2003-11-05 12:25:54 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -128,12 +128,12 @@ public: return (maVector == rCandidate.maVector); } - const basegfx::vector::B2DVector& getCoordinate(sal_uInt32 nIndex) const + const basegfx::point::B2DPoint& getCoordinate(sal_uInt32 nIndex) const { return maVector[nIndex].getCoordinate(); } - void setCoordinate(sal_uInt32 nIndex, const basegfx::vector::B2DVector& rValue) + void setCoordinate(sal_uInt32 nIndex, const basegfx::point::B2DPoint& rValue) { maVector[nIndex].setCoordinate(rValue); } @@ -192,6 +192,37 @@ public: } } } + + void removeDoublePointsAtBeginEnd() + { + // remove from end as long as there are at least two points + // and begin/end are equal + while((maVector.size() > 1L) && (maVector[0] == maVector[maVector.size() - 1L])) + { + maVector.pop_back(); + } + } + + void removeDoublePointsWholeTrack() + { + sal_uInt32 nIndex(0L); + + // test as long as there are at least two points and as long as the index + // is smaller or equal second last point + while((maVector.size() > 1L) && (nIndex <= maVector.size() - 2L)) + { + if(maVector[nIndex] == maVector[nIndex + 1L]) + { + // if next is same as index, delete next + maVector.erase(maVector.begin() + (nIndex + 1L)); + } + else + { + // if different, step forward + nIndex++; + } + } + } }; ////////////////////////////////////////////////////////////////////////////// @@ -765,6 +796,124 @@ public: } } } + + sal_Bool hasDoublePoints() const + { + if(mbIsClosed) + { + // check for same start and end point + const sal_uInt32 nIndex(maPoints.count() - 1L); + + if(maPoints.getCoordinate(0L) == maPoints.getCoordinate(nIndex)) + { + if(mpControlVector) + { + if(mpControlVector->getVectorA(nIndex).equalZero() + && mpControlVector->getVectorB(nIndex).equalZero()) + { + return sal_True; + } + } + else + { + return sal_True; + } + } + } + + // test for range + for(sal_uInt32 a(0L); a < maPoints.count() - 1L; a++) + { + if(maPoints.getCoordinate(a) == maPoints.getCoordinate(a + 1L)) + { + if(mpControlVector) + { + if(mpControlVector->getVectorA(a).equalZero() + && mpControlVector->getVectorB(a).equalZero()) + { + return sal_True; + } + } + else + { + return sal_True; + } + } + } + + return sal_False; + } + + void removeDoublePointsAtBeginEnd() + { + // Only remove DoublePoints at Begin and End when poly is closed + if(mbIsClosed) + { + if(mpControlVector) + { + sal_Bool bRemove; + + do + { + bRemove = sal_False; + + if(maPoints.count() > 1L) + { + const sal_uInt32 nIndex(maPoints.count() - 1L); + + if(maPoints.getCoordinate(0L) == maPoints.getCoordinate(nIndex)) + { + if(mpControlVector->getVectorA(nIndex).equalZero() + && mpControlVector->getVectorB(nIndex).equalZero()) + { + bRemove = sal_True; + } + } + } + + if(bRemove) + { + const sal_uInt32 nIndex(maPoints.count() - 1L); + remove(nIndex, 1L); + } + } while(bRemove); + } + else + { + maPoints.removeDoublePointsAtBeginEnd(); + } + } + } + + void removeDoublePointsWholeTrack() + { + if(mpControlVector) + { + sal_uInt32 nIndex(0L); + + // test as long as there are at least two points and as long as the index + // is smaller or equal second last point + while((maPoints.count() > 1L) && (nIndex <= maPoints.count() - 2L)) + { + if(maPoints.getCoordinate(nIndex) == maPoints.getCoordinate(nIndex + 1L) + && mpControlVector->getVectorA(nIndex).equalZero() + && mpControlVector->getVectorB(nIndex).equalZero()) + { + // if next is same as index and the control vectors are unused, delete index + remove(nIndex, 1L); + } + else + { + // if different, step forward + nIndex++; + } + } + } + else + { + maPoints.removeDoublePointsWholeTrack(); + } + } }; ////////////////////////////////////////////////////////////////////////////// @@ -836,7 +985,7 @@ namespace basegfx { if(mpPolygon == rPolygon.mpPolygon) { - return true; + return sal_True; } return mpPolygon->isEqual(*(rPolygon.mpPolygon)); @@ -846,7 +995,7 @@ namespace basegfx { if(mpPolygon == rPolygon.mpPolygon) { - return false; + return sal_False; } return !mpPolygon->isEqual(*(rPolygon.mpPolygon)); @@ -1034,6 +1183,21 @@ namespace basegfx mpPolygon->flip(); } } + + sal_Bool B2DPolygon::hasDoublePoints() const + { + return mpPolygon->hasDoublePoints(); + } + + void B2DPolygon::removeDoublePoints() + { + if(mpPolygon->count() > 1) + { + implForceUniqueCopy(); + mpPolygon->removeDoublePointsAtBeginEnd(); + mpPolygon->removeDoublePointsWholeTrack(); + } + } } // end of namespace polygon } // end of namespace basegfx diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx index 0c1136ca5553..c5b56dd72e31 100644 --- a/basegfx/source/polygon/b2dpolygontools.cxx +++ b/basegfx/source/polygon/b2dpolygontools.cxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dpolygontools.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2003-10-31 10:13:58 $ + * last change: $Author: aw $ $Date: 2003-11-05 12:25:54 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -67,8 +67,12 @@ #include <basegfx/polygon/b2dpolygon.hxx> #endif -#ifndef _BGFX_CURVE_B2DCUBICBEZIER_HXX -#include <basegfx/curve/b2dcubicbezier.hxx> +#ifndef _BGFX_NUMERIC_FTOOLS_HXX +#include <basegfx/numeric/ftools.hxx> +#endif + +#ifndef _BGFX_RANGE_B2DRANGE_HXX +#include <basegfx/range/b2drange.hxx> #endif ////////////////////////////////////////////////////////////////////////////// @@ -84,53 +88,415 @@ namespace basegfx { while(rCandidate.count() > 1L) { - bool bFirstLastPointEqual( - rCandidate.getB2DPoint(0L) == rCandidate.getB2DPoint(rCandidate.count() - 1L)); + sal_Bool bFirstLastPointEqual(rCandidate.getB2DPoint(0L).equal(rCandidate.getB2DPoint(rCandidate.count() - 1L))); if(bFirstLastPointEqual) { - rCandidate.setClosed(true); + rCandidate.setClosed(sal_True); rCandidate.remove(rCandidate.count() - 1L); } } } - // Checks if one of the control vectors is used - bool isEdgeBezier(const polygon::B2DPolygon& rPolygon, sal_uInt32 nEdgeIndex) + // Get index of outmost point (e.g. biggest X and biggest Y) + sal_uInt32 getIndexOfOutmostPoint(const polygon::B2DPolygon& rCandidate) + { + sal_uInt32 nRetval(0L); + + if(rCandidate.count()) + { + ::basegfx::point::B2DPoint aOutmostPoint(rCandidate.getB2DPoint(0L)); + + for(sal_uInt32 a(1L); a < rCandidate.count(); a++) + { + ::basegfx::point::B2DPoint rPoint(rCandidate.getB2DPoint(a)); + + if(::basegfx::numeric::fTools::more(rPoint.getX(), aOutmostPoint.getX())) + { + nRetval = a; + aOutmostPoint = rPoint; + } + else + { + if(::basegfx::numeric::fTools::more(rPoint.getY(), aOutmostPoint.getY())) + { + nRetval = a; + aOutmostPoint = rPoint; + } + } + } + } + + return nRetval; + } + + // Get successor and predecessor indices. Returning the same index means there + // is none. Same for successor. + sal_uInt32 getIndexOfPredecessor(sal_uInt32 nIndex, const polygon::B2DPolygon& rCandidate) + { + if(nIndex) + { + return nIndex - 1L; + } + else if(rCandidate.count()) + { + return rCandidate.count() - 1L; + } + else + { + return nIndex; + } + } + + sal_uInt32 getIndexOfSuccessor(sal_uInt32 nIndex, const polygon::B2DPolygon& rCandidate) + { + if(nIndex + 1L < rCandidate.count()) + { + return nIndex + 1L; + } + else + { + return 0L; + } + } + + sal_uInt32 getIndexOfDifferentPredecessor(sal_uInt32 nIndex, const polygon::B2DPolygon& rCandidate) + { + if(rCandidate.count() > 1) + { + sal_uInt32 nNewIndex = getIndexOfPredecessor(nIndex, rCandidate); + ::basegfx::point::B2DPoint aPoint(rCandidate.getB2DPoint(nIndex)); + + while(nNewIndex != nIndex + && aPoint.equal(rCandidate.getB2DPoint(nNewIndex))) + { + nNewIndex = getIndexOfPredecessor(nNewIndex, rCandidate); + } + } + + return nIndex; + } + + sal_uInt32 getIndexOfDifferentSuccessor(sal_uInt32 nIndex, const polygon::B2DPolygon& rCandidate) { - if(rPolygon.areControlPointsUsed()) + if(rCandidate.count() > 1) { - DBG_ASSERT(nEdgeIndex < rPolygon.count(), "EdgeIndex out of range (!)"); + sal_uInt32 nNewIndex = getIndexOfSuccessor(nIndex, rCandidate); + ::basegfx::point::B2DPoint aPoint(rCandidate.getB2DPoint(nIndex)); + + while(nNewIndex != nIndex + && aPoint.equal(rCandidate.getB2DPoint(nNewIndex))) + { + nNewIndex = getIndexOfSuccessor(nNewIndex, rCandidate); + } + } - if(!rPolygon.getControlPointA(nEdgeIndex).equalZero()) - return true; + return nIndex; + } + + ::basegfx::vector::B2DVectorOrientation getOrientation(const ::basegfx::polygon::B2DPolygon& rCandidate) + { + ::basegfx::vector::B2DVectorOrientation eRetval(::basegfx::vector::ORIENTATION_NEUTRAL); - if(!rPolygon.getControlPointB(nEdgeIndex).equalZero()) - return true; + if(rCandidate.count() > 2) + { + sal_uInt32 nIndex = getIndexOfOutmostPoint(rCandidate); + eRetval = getPointOrientation(rCandidate, nIndex); } - return false; + return eRetval; } - bool isEdgeTrivialBezier(const polygon::B2DPolygon& rPolygon, sal_uInt32 nEdgeIndex) + sal_Bool isInside(const ::basegfx::polygon::B2DPolygon& rCandidate, const ::basegfx::point::B2DPoint& rPoint) { - if(rPolygon.areControlPointsUsed()) + sal_Bool bRetval(sal_False); + const sal_uInt32 nPointCount(rCandidate.count()); + + for(sal_uInt32 a(0L); a < nPointCount; a++) { - DBG_ASSERT(nEdgeIndex < rPolygon.count(), "EdgeIndex out of range (!)"); - const sal_uInt32 nEndIndex((nEdgeIndex + 1L) % rPolygon.count()); + const basegfx::point::B2DPoint aCurrentPoint(rCandidate.getB2DPoint(a)); + const basegfx::point::B2DPoint aPreviousPoint(rCandidate.getB2DPoint((!a) ? nPointCount - 1L : a - 1L)); - curve::B2DCubicBezier aCubicBezier( - rPolygon.getB2DPoint(nEdgeIndex), - rPolygon.getControlPointA(nEdgeIndex), - rPolygon.getControlPointB(nEdgeIndex), - rPolygon.getB2DPoint(nEndIndex)); + // cross-over in Y? + const sal_Bool bCompYA(::basegfx::numeric::fTools::more(aPreviousPoint.getY(), rPoint.getY())); + const sal_Bool bCompYB(::basegfx::numeric::fTools::more(aCurrentPoint.getY(), rPoint.getY())); - aCubicBezier.testAndSolveTrivialBezier(); + if(bCompYA != bCompYB) + { + const sal_Bool bCompXA(::basegfx::numeric::fTools::more(aPreviousPoint.getX(), rPoint.getX())); + const sal_Bool bCompXB(::basegfx::numeric::fTools::more(aCurrentPoint.getX(), rPoint.getX())); + + if(bCompXA == bCompXB) + { + if(bCompXA) + { + bRetval = !bRetval; + } + } + else + { + const double fCompare = + aCurrentPoint.getX() - (aCurrentPoint.getY() - rPoint.getY()) * + (aPreviousPoint.getX() - aCurrentPoint.getX()) / + (aPreviousPoint.getY() - aCurrentPoint.getY()); + + if(::basegfx::numeric::fTools::more(fCompare, rPoint.getX())) + { + bRetval = !bRetval; + } + } + } + } + + return bRetval; + } + + sal_Bool isInside(const ::basegfx::polygon::B2DPolygon& rCandidate, const ::basegfx::polygon::B2DPolygon& rPolygon) + { + const sal_uInt32 nPointCount(rPolygon.count()); - return !aCubicBezier.isBezier(); + for(sal_uInt32 a(0L); a < nPointCount; a++) + { + const ::basegfx::point::B2DPoint aTestPoint(rPolygon.getB2DPoint(a)); + + if(!isInside(rCandidate, aTestPoint)) + { + return sal_False; + } + } + + return sal_True; + } + + ::basegfx::range::B2DRange getRange(const ::basegfx::polygon::B2DPolygon& rCandidate) + { + ::basegfx::range::B2DRange aRetval; + const sal_uInt32 nPointCount(rCandidate.count()); + + for(sal_uInt32 a(0L); a < nPointCount; a++) + { + const ::basegfx::point::B2DPoint aTestPoint(rCandidate.getB2DPoint(a)); + aRetval.expand(aTestPoint); + } + + return aRetval; + } + + double getArea(const ::basegfx::polygon::B2DPolygon& rCandidate) + { + double fRetval(0.0); + const sal_uInt32 nPointCount(rCandidate.count()); + + if(nPointCount > 2) + { + for(sal_uInt32 a(0L); a < nPointCount; a++) + { + const basegfx::point::B2DPoint aPreviousPoint(rCandidate.getB2DPoint((!a) ? nPointCount - 1L : a - 1L)); + const basegfx::point::B2DPoint aCurrentPoint(rCandidate.getB2DPoint(a)); + + fRetval += aPreviousPoint.getX() * aCurrentPoint.getY(); + fRetval -= aPreviousPoint.getY() * aCurrentPoint.getX(); + } + + fRetval /= 2.0; + + const double fZero(0.0); + + if(::basegfx::numeric::fTools::less(fRetval, fZero)) + { + fRetval = -fRetval; + } + } + + return fRetval; + } + + double getEdgeLength(const ::basegfx::polygon::B2DPolygon& rCandidate, sal_uInt32 nIndex) + { + double fRetval(0.0); + const sal_uInt32 nPointCount(rCandidate.count()); + + if(nIndex < nPointCount) + { + if(rCandidate.isClosed() || nIndex + 1 != nPointCount) + { + const sal_uInt32 nNextIndex(nIndex + 1 == nPointCount ? 0L : nIndex + 1L); + const basegfx::point::B2DPoint aCurrentPoint(rCandidate.getB2DPoint(nIndex)); + const basegfx::point::B2DPoint aNextPoint(rCandidate.getB2DPoint(nNextIndex)); + const basegfx::vector::B2DVector aVector(aNextPoint - aCurrentPoint); + fRetval = aVector.getLength(); + } + } + + return fRetval; + } + + double getLength(const ::basegfx::polygon::B2DPolygon& rCandidate) + { + // This method may also be implemented using a loop over getEdgeLength, but + // since this would cause a lot of sqare roots to be solved it is much better + // to sum up the quadrats first and then use a singe suare root (if necessary) + double fRetval(0.0); + const sal_uInt32 nPointCount(rCandidate.count()); + const sal_uInt32 nLoopCount(rCandidate.isClosed() ? nPointCount : nPointCount - 1L); + + for(sal_uInt32 a(0L); a < nLoopCount; a++) + { + const sal_uInt32 nNextIndex(a + 1 == nPointCount ? 0L : a + 1L); + const basegfx::point::B2DPoint aCurrentPoint(rCandidate.getB2DPoint(a)); + const basegfx::point::B2DPoint aNextPoint(rCandidate.getB2DPoint(nNextIndex)); + const basegfx::vector::B2DVector aVector(aNextPoint - aCurrentPoint); + fRetval += aVector.scalar(aVector); + } + + if(!::basegfx::numeric::fTools::equalZero(fRetval)) + { + const double fOne(1.0); + + if(!::basegfx::numeric::fTools::equal(fOne, fRetval)) + { + fRetval = sqrt(fRetval); + } + } + + return fRetval; + } + + ::basegfx::point::B2DPoint getPositionAbsolute(const ::basegfx::polygon::B2DPolygon& rCandidate, double fDistance, double fLength) + { + ::basegfx::point::B2DPoint aRetval; + const sal_uInt32 nPointCount(rCandidate.count()); + + if(nPointCount > 1L) + { + sal_uInt32 nIndex(0L); + sal_Bool bIndexDone(sal_False); + const double fZero(0.0); + double fEdgeLength(fZero); + + // get length if not given + if(::basegfx::numeric::fTools::equalZero(fLength)) + { + fLength = getLength(rCandidate); + } + + // handle fDistance < 0.0 + if(::basegfx::numeric::fTools::less(fDistance, fZero)) + { + if(rCandidate.isClosed()) + { + // if fDistance < 0.0 increment with multiple of fLength + sal_uInt32 nCount(sal_uInt32(-fDistance / fLength)); + fDistance += double(nCount + 1L) * fLength; + } + else + { + // crop to polygon start + fDistance = fZero; + bIndexDone = sal_True; + } + } + + // handle fDistance >= fLength + if(::basegfx::numeric::fTools::moreOrEqual(fDistance, fLength)) + { + if(rCandidate.isClosed()) + { + // if fDistance >= fLength decrement with multiple of fLength + sal_uInt32 nCount(sal_uInt32(fDistance / fLength)); + fDistance -= (double)(nCount) * fLength; + } + else + { + // crop to polygon end + fDistance = fZero; + nIndex = nPointCount - 1L; + bIndexDone = sal_True; + } + } + + // look for correct index. fDistance is now [0.0 .. fLength[ + if(!bIndexDone) + { + do + { + // get length of next edge + fEdgeLength = getEdgeLength(rCandidate, nIndex); + + if(::basegfx::numeric::fTools::moreOrEqual(fDistance, fEdgeLength)) + { + // go to next edge + fDistance -= fEdgeLength; + nIndex++; + } + else + { + // it's on this edge, stop + bIndexDone = sal_True; + } + } while (!bIndexDone); + } + + // get the point using nIndex + aRetval = rCandidate.getB2DPoint(nIndex); + + // if fDistance != 0.0, move that length on the edge. The edge + // length is in fEdgeLength. + if(!::basegfx::numeric::fTools::equalZero(fDistance)) + { + sal_uInt32 nNextIndex(getIndexOfSuccessor(nIndex, rCandidate)); + const ::basegfx::point::B2DPoint aNextPoint(rCandidate.getB2DPoint(nNextIndex)); + double fRelative(fZero); + + if(!::basegfx::numeric::fTools::equalZero(fEdgeLength)) + { + fRelative = fDistance / fEdgeLength; + } + + // add calculated average value to the return value + aRetval += ::basegfx::tuple::average(aRetval, aNextPoint, fRelative); + } + } + + return aRetval; + } + + ::basegfx::point::B2DPoint getPositionRelative(const ::basegfx::polygon::B2DPolygon& rCandidate, double fDistance, double fLength) + { + // get length if not given + if(::basegfx::numeric::fTools::equalZero(fLength)) + { + fLength = getLength(rCandidate); + } + + // multiply fDistance with real length to get absolute position and + // use getPositionAbsolute + return getPositionAbsolute(rCandidate, fDistance * fLength, fLength); + } + + ::basegfx::vector::B2DVectorOrientation getPointOrientation(const ::basegfx::polygon::B2DPolygon& rCandidate, sal_uInt32 nIndex) + { + ::basegfx::vector::B2DVectorOrientation eRetval(::basegfx::vector::ORIENTATION_NEUTRAL); + + if(rCandidate.count() > 2) + { + sal_uInt32 nIndPrev = getIndexOfDifferentPredecessor(nIndex, rCandidate); + + if(nIndPrev != nIndex) + { + sal_uInt32 nIndNext = getIndexOfDifferentSuccessor(nIndex, rCandidate); + + if(nIndNext != nIndex && nIndNext != nIndPrev) + { + ::basegfx::point::B2DPoint aPoint(rCandidate.getB2DPoint(nIndex)); + ::basegfx::vector::B2DVector aVecPrev(rCandidate.getB2DPoint(nIndPrev) - aPoint); + ::basegfx::vector::B2DVector aVecNext(rCandidate.getB2DPoint(nIndNext) - aPoint); + eRetval = ::basegfx::vector::getOrientation(aVecPrev, aVecNext); + } + } } - return true; + return eRetval; } } // end of namespace tools } // end of namespace polygon diff --git a/basegfx/source/polygon/b2dpolypolygon.cxx b/basegfx/source/polygon/b2dpolypolygon.cxx index 642f25b469e6..b1183a6cf052 100644 --- a/basegfx/source/polygon/b2dpolypolygon.cxx +++ b/basegfx/source/polygon/b2dpolypolygon.cxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dpolypolygon.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2003-10-31 10:13:58 $ + * last change: $Author: aw $ $Date: 2003-11-05 12:25:54 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -71,6 +71,10 @@ #include <tools/debug.hxx> #endif +#ifndef _BGFX_POLYPOLYGON_B2DPOLYGONTOOLS_HXX +#include <basegfx/polygon/b2dpolypolygontools.hxx> +#endif + #include <vector> ////////////////////////////////////////////////////////////////////////////// @@ -106,21 +110,21 @@ public: void incRefCount() { mnRefCount++; } void decRefCount() { mnRefCount--; } - bool isEqual(const ImplB2DPolyPolygon& rPolygonList) const + sal_Bool isEqual(const ImplB2DPolyPolygon& rPolygonList) const { // same polygon count? if(maPolygons.size() != rPolygonList.maPolygons.size()) - return false; + return sal_False; // if zero polygons the polys are equal if(!maPolygons.size()) - return true; + return sal_True; // compare polygon content if(maPolygons != rPolygonList.maPolygons) - return false; + return sal_False; - return true; + return sal_True; } const basegfx::polygon::B2DPolygon& getPolygon(sal_uInt32 nIndex) const @@ -180,6 +184,30 @@ public: { return maPolygons.size(); } + + void setClosed(sal_Bool bNew) + { + for(sal_uInt32 a(0L); a < maPolygons.size(); a++) + { + maPolygons[a].setClosed(bNew); + } + } + + void flip() + { + for(sal_uInt32 a(0L); a < maPolygons.size(); a++) + { + maPolygons[a].flip(); + } + } + + void removeDoublePoints() + { + for(sal_uInt32 a(0L); a < maPolygons.size(); a++) + { + maPolygons[a].removeDoublePoints(); + } + } }; ////////////////////////////////////////////////////////////////////////////// @@ -241,21 +269,21 @@ namespace basegfx return *this; } - bool B2DPolyPolygon::operator==(const B2DPolyPolygon& rPolyPolygon) const + sal_Bool B2DPolyPolygon::operator==(const B2DPolyPolygon& rPolyPolygon) const { if(mpPolyPolygon == rPolyPolygon.mpPolyPolygon) { - return true; + return sal_True; } return mpPolyPolygon->isEqual(*(rPolyPolygon.mpPolyPolygon)); } - bool B2DPolyPolygon::operator!=(const B2DPolyPolygon& rPolyPolygon) const + sal_Bool B2DPolyPolygon::operator!=(const B2DPolyPolygon& rPolyPolygon) const { if(mpPolyPolygon == rPolyPolygon.mpPolyPolygon) { - return false; + return sal_False; } return !mpPolyPolygon->isEqual(*(rPolyPolygon.mpPolyPolygon)); @@ -349,6 +377,68 @@ namespace basegfx mpPolyPolygon = &maStaticDefaultPolyPolygon; mpPolyPolygon->incRefCount(); } + + sal_Bool B2DPolyPolygon::isClosed() const + { + sal_Bool bRetval(sal_True); + + // PolyPOlygon is closed when all contained Polygons are closed or + // no Polygon exists. + for(sal_uInt32 a(0L); bRetval && a < mpPolyPolygon->count(); a++) + { + if(!(mpPolyPolygon->getPolygon(a)).isClosed()) + { + bRetval = sal_False; + } + } + + return bRetval; + } + + void B2DPolyPolygon::setClosed(sal_Bool bNew) + { + if(bNew != isClosed()) + { + implForceUniqueCopy(); + mpPolyPolygon->setClosed(bNew); + } + } + + ::basegfx::vector::B2DVectorOrientation B2DPolyPolygon::checkOrientations() + { + implForceUniqueCopy(); + return ::basegfx::polygon::tools::checkOrientations(*this); + } + + void B2DPolyPolygon::flip() + { + implForceUniqueCopy(); + mpPolyPolygon->flip(); + } + + sal_Bool B2DPolyPolygon::hasDoublePoints() const + { + sal_Bool bRetval(sal_False); + + for(sal_uInt32 a(0L); !bRetval && a < mpPolyPolygon->count(); a++) + { + if((mpPolyPolygon->getPolygon(a)).hasDoublePoints()) + { + bRetval = sal_True; + } + } + + return bRetval; + } + + void B2DPolyPolygon::removeDoublePoints() + { + if(hasDoublePoints()) + { + implForceUniqueCopy(); + mpPolyPolygon->removeDoublePoints(); + } + } } // end of namespace polygon } // end of namespace basegfx diff --git a/basegfx/source/polygon/makefile.mk b/basegfx/source/polygon/makefile.mk index 6d2921a7155f..7e6e3384c48e 100644 --- a/basegfx/source/polygon/makefile.mk +++ b/basegfx/source/polygon/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.1 $ +# $Revision: 1.2 $ # -# last change: $Author: aw $ $Date: 2003-10-28 11:23:55 $ +# last change: $Author: aw $ $Date: 2003-11-05 12:25:55 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -75,9 +75,10 @@ TARGET=polygon # --- Files ------------------------------------- SLOFILES= \ - $(SLO)$/b2dpolygon.obj \ - $(SLO)$/b2dpolygontools.obj \ - $(SLO)$/b2dpolypolygon.obj + $(SLO)$/b2dpolygon.obj \ + $(SLO)$/b2dpolygontools.obj \ + $(SLO)$/b2dpolypolygon.obj \ + $(SLO)$/b2dpolypolygontools.obj # --- Targets ---------------------------------- diff --git a/basegfx/source/tuple/b2dtuple.cxx b/basegfx/source/tuple/b2dtuple.cxx index ded4d23a05cd..367ea17285dd 100644 --- a/basegfx/source/tuple/b2dtuple.cxx +++ b/basegfx/source/tuple/b2dtuple.cxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dtuple.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2003-10-31 10:14:00 $ + * last change: $Author: aw $ $Date: 2003-11-05 12:25:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -74,26 +74,26 @@ namespace basegfx // initialize static member B2DTuple B2DTuple::maEmptyTuple(0.0, 0.0); - bool B2DTuple::equalZero() const + sal_Bool B2DTuple::equalZero() const { return (this == &maEmptyTuple || (::basegfx::numeric::fTools::equalZero(mfX) && ::basegfx::numeric::fTools::equalZero(mfY))); } - bool B2DTuple::equalZero(const double& rfSmallValue) const + sal_Bool B2DTuple::equalZero(const double& rfSmallValue) const { return (this == &maEmptyTuple || (::basegfx::numeric::fTools::equalZero(mfX, rfSmallValue) && ::basegfx::numeric::fTools::equalZero(mfY, rfSmallValue))); } - bool B2DTuple::equal(const B2DTuple& rTup) const + sal_Bool B2DTuple::equal(const B2DTuple& rTup) const { return ( ::basegfx::numeric::fTools::equal(mfX, rTup.mfX) && ::basegfx::numeric::fTools::equal(mfY, rTup.mfY)); } - bool B2DTuple::equal(const B2DTuple& rTup, const double& rfSmallValue) const + sal_Bool B2DTuple::equal(const B2DTuple& rTup, const double& rfSmallValue) const { return ( ::basegfx::numeric::fTools::equal(mfX, rTup.mfX, rfSmallValue) && diff --git a/basegfx/source/vector/b2dvector.cxx b/basegfx/source/vector/b2dvector.cxx index 6890333cdc2e..ea3abe72be3a 100644 --- a/basegfx/source/vector/b2dvector.cxx +++ b/basegfx/source/vector/b2dvector.cxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dvector.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2003-10-31 10:14:00 $ + * last change: $Author: aw $ $Date: 2003-11-05 12:25:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -153,7 +153,7 @@ namespace basegfx return *this; } - bool B2DVector::isNormalized() const + sal_Bool B2DVector::isNormalized() const { const double fOne(1.0); const double fScalar(scalar(*this)); @@ -161,27 +161,27 @@ namespace basegfx return (::basegfx::numeric::fTools::equal(fOne, fScalar)); } - bool areParallel( const B2DVector& rVecA, const B2DVector& rVecB ) + sal_Bool areParallel( const B2DVector& rVecA, const B2DVector& rVecB ) { double fVal(rVecA.getX() * rVecB.getY() - rVecA.getY() * rVecA.getX()); return ::basegfx::numeric::fTools::equalZero(fVal); } - B2DVector::B2DVectorOrientation getOrientation( const B2DVector& rVecA, const B2DVector& rVecB ) + B2DVectorOrientation getOrientation( const B2DVector& rVecA, const B2DVector& rVecB ) { double fVal(rVecA.getX() * rVecB.getY() - rVecA.getY() * rVecA.getX()); if(fVal > 0.0) { - return B2DVector::POSITIVE; + return ORIENTATION_POSITIVE; } if(fVal < 0.0) { - return B2DVector::NEGATIVE; + return ORIENTATION_NEGATIVE; } - return B2DVector::NEUTRAL; + return ORIENTATION_NEUTRAL; } B2DVector getPerpendicular( const B2DVector& rNormalizedVec ) diff --git a/basegfx/source/workbench/bezierclip.cxx b/basegfx/source/workbench/bezierclip.cxx index a413544d17eb..7fb95c4977b1 100644 --- a/basegfx/source/workbench/bezierclip.cxx +++ b/basegfx/source/workbench/bezierclip.cxx @@ -2,9 +2,9 @@ * * $RCSfile: bezierclip.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: thb $ $Date: 2003-03-06 18:57:47 $ + * last change: $Author: aw $ $Date: 2003-11-05 12:25:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -183,7 +183,7 @@ void Impl_calcBounds( Point2D& leftTop, rightBottom.y = ::std::max( c1.p0.y, ::std::max( c1.p1.y, ::std::max( c1.p2.y, c1.p3.y ) ) ); } -bool Impl_doBBoxIntersect( const Bezier& c1, +sal_Bool Impl_doBBoxIntersect( const Bezier& c1, const Bezier& c2 ) { // calc rectangular boxes from c1 and c2 @@ -198,11 +198,11 @@ bool Impl_doBBoxIntersect( const Bezier& c1, if( ::std::min(rb1.x, rb2.x) < ::std::max(lt1.x, lt2.x) || ::std::min(rb1.y, rb2.y) < ::std::max(lt1.y, lt2.y) ) { - return false; + return sal_False; } else { - return true; + return sal_True; } } @@ -211,7 +211,7 @@ bool Impl_doBBoxIntersect( const Bezier& c1, * the left, the second is the intersection of the max value line with * the convex hull from the right. */ -bool Impl_calcSafeParams( double& t1, +sal_Bool Impl_calcSafeParams( double& t1, double& t2, const Polygon2D& rPoly, double lowerYBound, @@ -229,13 +229,13 @@ bool Impl_calcSafeParams( double& t1, double currHigherT( 0.0 ); if( convHull.size() <= 1 ) - return false; // only one point? Then we're done with clipping + return sal_False; // only one point? Then we're done with clipping /* now, clip against lower and higher bounds */ Point2D p0; Point2D p1; - bool bIntersection( false ); + sal_Bool bIntersection( sal_False ); for( Polygon2D::size_type i=0; i<convHull.size(); ++i ) { @@ -298,7 +298,7 @@ bool Impl_calcSafeParams( double& t1, // set flag that at least one segment is contained or // intersects given horizontal band. - bIntersection = true; + bIntersection = sal_True; } } @@ -320,7 +320,7 @@ bool Impl_calcSafeParams( double& t1, * The polynomial coefficients c0 to c3 given to this method * must correspond to t values of 0, 1/3, 2/3 and 1, respectively. */ -bool Impl_calcSafeParams_clip( double& t1, +sal_Bool Impl_calcSafeParams_clip( double& t1, double& t2, const FatLine& bounds, double c0, @@ -340,7 +340,7 @@ bool Impl_calcSafeParams_clip( double& t1, return Impl_calcSafeParams( t1, t2, poly, bounds.dMin, bounds.dMax ); #else - bool bRet( Impl_calcSafeParams( t1, t2, poly, bounds.dMin, bounds.dMax ) ); + sal_Bool bRet( Impl_calcSafeParams( t1, t2, poly, bounds.dMin, bounds.dMax ) ); Polygon2D convHull( convexHull( poly ) ); @@ -592,7 +592,7 @@ void printResultWithFinalCurves( const Bezier& c1, const Bezier& c1_part, // ----------------------------------------------------------------------------- /** determine parameter ranges [0,t1) and (t2,1] on c1, where c1 is guaranteed to lie outside c2. - Returns false, if the two curves don't even intersect. + Returns sal_False, if the two curves don't even intersect. @param t1 Range [0,t1) on c1 is guaranteed to lie outside c2 @@ -612,7 +612,7 @@ void printResultWithFinalCurves( const Bezier& c1, const Bezier& c1_part, @param c2_part Subdivided current part of c2 */ -bool Impl_calcClipRange( double& t1, +sal_Bool Impl_calcClipRange( double& t1, double& t2, const Bezier& c1_orig, const Bezier& c1_part, @@ -661,12 +661,12 @@ bool Impl_calcClipRange( double& t1, //printCurvesWithSafeRange(c1_orig, c2_orig, t1, t2, c2_part, bounds_c2); // they do intersect - return true; + return sal_True; } } // they don't intersect: nothing to do - return false; + return sal_False; } // ----------------------------------------------------------------------------- @@ -804,7 +804,7 @@ void Impl_calcFocus( Bezier& res, const Bezier& c ) // ----------------------------------------------------------------------------- -bool Impl_calcSafeParams_focus( double& t1, +sal_Bool Impl_calcSafeParams_focus( double& t1, double& t2, const Bezier& curve, const Bezier& focus ) @@ -913,7 +913,7 @@ bool Impl_calcSafeParams_focus( double& t1, return Impl_calcSafeParams( t1, t2, controlPolygon, 0.0, 0.0 ); #else - bool bRet( Impl_calcSafeParams( t1, t2, controlPolygon, 0.0, 0.0 ) ); + sal_Bool bRet( Impl_calcSafeParams( t1, t2, controlPolygon, 0.0, 0.0 ) ); Polygon2D convHull( convexHull( controlPolygon ) ); @@ -957,12 +957,12 @@ bool Impl_calcSafeParams_focus( double& t1, don't intersect, nothing is added. @param delta - Maximal allowed distance to true critical point (measured in the + Maximal allowed distance to sal_True critical point (measured in the original curve's coordinate system) @param safeRangeFunctor Functor object, that must provide the following operator(): - bool safeRangeFunctor( double& t1, + sal_Bool safeRangeFunctor( double& t1, double& t2, const Bezier& c1_orig, const Bezier& c1_part, @@ -970,7 +970,7 @@ bool Impl_calcSafeParams_focus( double& t1, const Bezier& c2_part ); This functor must calculate the safe ranges [0,t1] and [t2,1] on c1_orig, where c1_orig is 'safe' from c2_part. If the whole - c1_orig is safe, false must be returned, true otherwise. + c1_orig is safe, sal_False must be returned, sal_True otherwise. */ template <class Functor> void Impl_applySafeRanges_rec( ::std::back_insert_iterator< ::std::vector< ::std::pair<double, double> > >& result, double delta, @@ -1026,7 +1026,7 @@ template <class Functor> void Impl_applySafeRanges_rec( ::std::back_insert_itera // Note: we first perform the clipping and only test for precision // sufficiency afterwards, since we want to exploit the fact that - // Impl_calcClipRange returns false if the curves don't + // Impl_calcClipRange returns sal_False if the curves don't // intersect. We would have to check that separately for the end // condition, otherwise. @@ -1097,7 +1097,7 @@ template <class Functor> void Impl_applySafeRanges_rec( ::std::back_insert_itera // 20%, subdivide longest curve, and clip shortest against // both parts of longest // if( (last_t2_c1 - last_t1_c1 - t2_c1 + t1_c1) / (last_t2_c1 - last_t1_c1) < 0.2 ) - if( false ) + if( sal_False ) { // subdivide and descend // ===================== @@ -1189,7 +1189,7 @@ template <class Functor> void Impl_applySafeRanges_rec( ::std::back_insert_itera struct ClipBezierFunctor { - bool operator()( double& t1_c1, + sal_Bool operator()( double& t1_c1, double& t2_c1, const Bezier& c1_orig, const Bezier& c1_part, @@ -1204,7 +1204,7 @@ struct ClipBezierFunctor struct BezierTangencyFunctor { - bool operator()( double& t1_c1, + sal_Bool operator()( double& t1_c1, double& t2_c1, const Bezier& c1_orig, const Bezier& c1_part, @@ -1218,7 +1218,7 @@ struct BezierTangencyFunctor // used for focus calculation // determine safe range on c1_orig - bool bRet( Impl_calcSafeParams_focus( t1_c1, t2_c1, + sal_Bool bRet( Impl_calcSafeParams_focus( t1_c1, t2_c1, c1_orig, // use orig curve here, need t's on original curve focus ) ); @@ -1237,7 +1237,7 @@ struct BezierTangencyFunctor iterator will remain empty, if there are no intersections. @param delta - Maximal allowed distance to true intersection (measured in the + Maximal allowed distance to sal_True intersection (measured in the original curve's coordinate system) */ void clipBezier( ::std::back_insert_iterator< ::std::vector< ::std::pair<double, double> > >& result, @@ -1646,7 +1646,7 @@ int main(int argc, const char *argv[]) double t1, t2; - bool bRet( Impl_calcSafeParams( t1, t2, poly, 0, 1 ) ); + sal_Bool bRet( Impl_calcSafeParams( t1, t2, poly, 0, 1 ) ); Polygon2D convHull( convexHull( poly ) ); @@ -1872,7 +1872,7 @@ int main(int argc, const char *argv[]) focus = c2; #endif // determine safe range on c1 - bool bRet( Impl_calcSafeParams_focus( t1, t2, + sal_Bool bRet( Impl_calcSafeParams_focus( t1, t2, c1, focus ) ); cerr << "t1: " << t1 << ", t2: " << t2 << endl; diff --git a/basegfx/source/workbench/bezierclip.hxx b/basegfx/source/workbench/bezierclip.hxx index 0322354e9e9b..b151a9bdd43f 100644 --- a/basegfx/source/workbench/bezierclip.hxx +++ b/basegfx/source/workbench/bezierclip.hxx @@ -2,9 +2,9 @@ * * $RCSfile: bezierclip.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: thb $ $Date: 2003-03-06 18:57:48 $ + * last change: $Author: aw $ $Date: 2003-11-05 12:25:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -119,9 +119,9 @@ Polygon2D convexHull( const Polygon2D& rPoly ); #define DBL_EPSILON 1.0e-100 /* little approximate comparions */ -template <typename NumType> bool tolZero( NumType n ) { return fabs(n) < DBL_EPSILON; } -template <typename NumType> bool tolEqual( NumType n1, NumType n2 ) { return tolZero(n1-n2); } -template <typename NumType> bool tolLessEqual( NumType n1, NumType n2 ) { return tolEqual(n1,n2) || n1<n2; } -template <typename NumType> bool tolGreaterEqual( NumType n1, NumType n2 ) { return tolEqual(n1,n2) || n1>n2; } +template <typename NumType> sal_Bool tolZero( NumType n ) { return fabs(n) < DBL_EPSILON; } +template <typename NumType> sal_Bool tolEqual( NumType n1, NumType n2 ) { return tolZero(n1-n2); } +template <typename NumType> sal_Bool tolLessEqual( NumType n1, NumType n2 ) { return tolEqual(n1,n2) || n1<n2; } +template <typename NumType> sal_Bool tolGreaterEqual( NumType n1, NumType n2 ) { return tolEqual(n1,n2) || n1>n2; } #endif // BASEGFX_BEZIERCLIP_HXX diff --git a/basegfx/source/workbench/convexhull.cxx b/basegfx/source/workbench/convexhull.cxx index 662804c12848..3765d70663bc 100644 --- a/basegfx/source/workbench/convexhull.cxx +++ b/basegfx/source/workbench/convexhull.cxx @@ -2,9 +2,9 @@ * * $RCSfile: convexhull.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: thb $ $Date: 2003-03-06 18:57:49 $ + * last change: $Author: aw $ $Date: 2003-11-05 12:25:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -88,14 +88,14 @@ template <class PointType> double theta( const PointType& p1, const PointType& p /* Model of LessThanComparable for theta sort. * Uses the theta function from Sedgewick: Algorithms in XXX, chapter 24 */ -template <class PointType> class ThetaCompare : public ::std::binary_function< const PointType&, const PointType&, bool > +template <class PointType> class ThetaCompare : public ::std::binary_function< const PointType&, const PointType&, sal_Bool > { public: ThetaCompare( const PointType& rRefPoint ) : maRefPoint( rRefPoint ) {} - bool operator() ( const PointType& p1, const PointType& p2 ) + sal_Bool operator() ( const PointType& p1, const PointType& p2 ) { - // return true, if p1 precedes p2 in the angle relative to maRefPoint + // return sal_True, if p1 precedes p2 in the angle relative to maRefPoint return theta(maRefPoint, p1) < theta(maRefPoint, p2); } diff --git a/basegfx/source/workbench/gauss.hxx b/basegfx/source/workbench/gauss.hxx index 780f3255958e..b5b65e2644c9 100644 --- a/basegfx/source/workbench/gauss.hxx +++ b/basegfx/source/workbench/gauss.hxx @@ -2,9 +2,9 @@ * * $RCSfile: gauss.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: thb $ $Date: 2003-03-06 18:57:49 $ + * last change: $Author: aw $ $Date: 2003-11-05 12:25:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -76,12 +76,12 @@ @param minPivot If the pivot element gets lesser than minPivot, this method fails, - otherwise, elimination succeeds and true is returned. + otherwise, elimination succeeds and sal_True is returned. - @return true, if elimination succeeded. + @return sal_True, if elimination succeeded. */ template <class Matrix, typename BaseType> -bool eliminate( Matrix& matrix, +sal_Bool eliminate( Matrix& matrix, int rows, int cols, const BaseType& minPivot ) @@ -100,7 +100,7 @@ bool eliminate( Matrix& matrix, /* check pivot value */ if( fabs(matrix[ max*cols + i ]) < minPivot ) - return false; /* pivot too small! */ + return sal_False; /* pivot too small! */ /* interchange rows 'max' and 'i' */ for(k=0; k<cols; ++k) @@ -118,7 +118,7 @@ bool eliminate( Matrix& matrix, } /* everything went well */ - return true; + return sal_True; } @@ -139,11 +139,11 @@ bool eliminate( Matrix& matrix, @param result Result vector. Given matrix must have space for one column (rows entries). - @return true, if back substitution was possible (i.e. no division + @return sal_True, if back substitution was possible (i.e. no division by zero occured). */ template <class Matrix, class Vector, typename BaseType> -bool substitute( const Matrix& matrix, +sal_Bool substitute( const Matrix& matrix, int rows, int cols, Vector& result ) @@ -159,13 +159,13 @@ bool substitute( const Matrix& matrix, temp += matrix[ j*cols + k ] * result[k]; if( matrix[ j*cols + j ] == 0.0 ) - return false; /* imminent division by zero! */ + return sal_False; /* imminent division by zero! */ result[j] = (matrix[ j*cols + cols-1 ] - temp) / matrix[ j*cols + j ]; } /* everything went well */ - return true; + return sal_True; } @@ -188,12 +188,12 @@ bool substitute( const Matrix& matrix, @param minPivot If the pivot element gets lesser than minPivot, this method fails, - otherwise, elimination succeeds and true is returned. + otherwise, elimination succeeds and sal_True is returned. - @return true, if elimination succeeded. + @return sal_True, if elimination succeeded. */ template <class Matrix, class Vector, typename BaseType> -bool solve( Matrix& matrix, +sal_Bool solve( Matrix& matrix, int rows, int cols, Vector& result, @@ -202,5 +202,5 @@ bool solve( Matrix& matrix, if( eliminate<Matrix,BaseType>(matrix, rows, cols, minPivot) ) return substitute<Matrix,Vector,BaseType>(matrix, rows, cols, result); - return false; + return sal_False; } |