diff options
Diffstat (limited to 'basegfx/source/polygon/b2dpolygoncutandtouch.cxx')
-rw-r--r-- | basegfx/source/polygon/b2dpolygoncutandtouch.cxx | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx index ac118e73356f..31c4a518a0b1 100644 --- a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx +++ b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -44,7 +44,7 @@ ////////////////////////////////////////////////////////////////////////////// // defines -#define SUBDIVIDE_FOR_CUT_TEST_COUNT (50) +#define SUBDIVIDE_FOR_CUT_TEST_COUNT (50) ////////////////////////////////////////////////////////////////////////////// @@ -56,13 +56,13 @@ namespace basegfx class temporaryPoint { - B2DPoint maPoint; // the new point - sal_uInt32 mnIndex; // index after which to insert - double mfCut; // parametric cut description [0.0 .. 1.0] + B2DPoint maPoint; // the new point + sal_uInt32 mnIndex; // index after which to insert + double mfCut; // parametric cut description [0.0 .. 1.0] public: temporaryPoint(const B2DPoint& rNewPoint, sal_uInt32 nIndex, double fCut) - : maPoint(rNewPoint), + : maPoint(rNewPoint), mnIndex(nIndex), mfCut(fCut) { @@ -91,9 +91,9 @@ namespace basegfx class temporaryPolygonData { - B2DPolygon maPolygon; - B2DRange maRange; - temporaryPointVector maPoints; + B2DPolygon maPolygon; + B2DRange maRange; + temporaryPointVector maPoints; public: const B2DPolygon& getPolygon() const { return maPolygon; } @@ -127,12 +127,12 @@ namespace basegfx // add start point aRetval.append(rCandidate.getB2DPoint(0)); - + for(sal_uInt32 a(0L); a < nCount; a++) { // get edge rCandidate.getBezierSegment(a, aEdge); - + if(aEdge.isBezier()) { // control vectors involved for this edge @@ -172,7 +172,7 @@ namespace basegfx aRetval.append(aNewPoint); } } - + // add edge end point aRetval.append(aEdge.getEndPoint()); } @@ -184,7 +184,7 @@ namespace basegfx // set closed flag and correct last point (which is added double now). tools::closeWithGeometryChange(aRetval); } - + return aRetval; } else @@ -239,8 +239,8 @@ namespace basegfx //////////////////////////////////////////////////////////////////////////////// void findEdgeCutsTwoEdges( - const B2DPoint& rCurrA, const B2DPoint& rNextA, - const B2DPoint& rCurrB, const B2DPoint& rNextB, + const B2DPoint& rCurrA, const B2DPoint& rNextA, + const B2DPoint& rCurrB, const B2DPoint& rNextB, sal_uInt32 nIndA, sal_uInt32 nIndB, temporaryPointVector& rTempPointsA, temporaryPointVector& rTempPointsB) { @@ -416,7 +416,7 @@ namespace basegfx void findEdgeCutsBezierAndEdge( const B2DCubicBezier& rCubicA, - const B2DPoint& rCurrB, const B2DPoint& rNextB, + const B2DPoint& rCurrB, const B2DPoint& rNextB, sal_uInt32 nIndA, sal_uInt32 nIndB, temporaryPointVector& rTempPointsA, temporaryPointVector& rTempPointsB) { @@ -430,7 +430,7 @@ namespace basegfx // create subdivided polygons and find cuts between them // Keep adaptiveSubdivideByCount due to needed quality - aTempPolygonA.reserve(SUBDIVIDE_FOR_CUT_TEST_COUNT + 8); + aTempPolygonA.reserve(SUBDIVIDE_FOR_CUT_TEST_COUNT + 8); aTempPolygonA.append(rCubicA.getStartPoint()); rCubicA.adaptiveSubdivideByCount(aTempPolygonA, SUBDIVIDE_FOR_CUT_TEST_COUNT); aTempPolygonEdge.append(rCurrB); @@ -471,10 +471,10 @@ namespace basegfx // create subdivided polygons and find cuts between them // Keep adaptiveSubdivideByCount due to needed quality - aTempPolygonA.reserve(SUBDIVIDE_FOR_CUT_TEST_COUNT + 8); + aTempPolygonA.reserve(SUBDIVIDE_FOR_CUT_TEST_COUNT + 8); aTempPolygonA.append(rCubicA.getStartPoint()); rCubicA.adaptiveSubdivideByCount(aTempPolygonA, SUBDIVIDE_FOR_CUT_TEST_COUNT); - aTempPolygonB.reserve(SUBDIVIDE_FOR_CUT_TEST_COUNT + 8); + aTempPolygonB.reserve(SUBDIVIDE_FOR_CUT_TEST_COUNT + 8); aTempPolygonB.append(rCubicB.getStartPoint()); rCubicB.adaptiveSubdivideByCount(aTempPolygonB, SUBDIVIDE_FOR_CUT_TEST_COUNT); @@ -515,7 +515,7 @@ namespace basegfx // create subdivided polygon and find cuts on it // Keep adaptiveSubdivideByCount due to needed quality - aTempPolygon.reserve(SUBDIVIDE_FOR_CUT_TEST_COUNT + 8); + aTempPolygon.reserve(SUBDIVIDE_FOR_CUT_TEST_COUNT + 8); aTempPolygon.append(rCubicA.getStartPoint()); rCubicA.adaptiveSubdivideByCount(aTempPolygon, SUBDIVIDE_FOR_CUT_TEST_COUNT); findCuts(aTempPolygon, aTempPointVector); @@ -595,7 +595,7 @@ namespace basegfx else { // test for simple edge-edge cuts - findEdgeCutsTwoEdges(aCubicA.getStartPoint(), aCubicA.getEndPoint(), aCubicB.getStartPoint(), aCubicB.getEndPoint(), + findEdgeCutsTwoEdges(aCubicA.getStartPoint(), aCubicA.getEndPoint(), aCubicB.getStartPoint(), aCubicB.getEndPoint(), a, b, rTempPoints, rTempPoints); } } @@ -616,7 +616,7 @@ namespace basegfx { const B2DPoint aNextB(rCandidate.getB2DPoint(b + 1L == nPointCount ? 0L : b + 1L)); const B2DRange aRangeB(aCurrB, aNextB); - + // consecutive segments touch of course bool bOverlap = false; if( b > a+1) @@ -627,7 +627,7 @@ namespace basegfx { findEdgeCutsTwoEdges(aCurrA, aNextA, aCurrB, aNextB, a, b, rTempPoints, rTempPoints); } - + // prepare next step aCurrB = aNextB; } @@ -654,13 +654,13 @@ namespace basegfx //////////////////////////////////////////////////////////////////////////////// void findTouchesOnEdge( - const B2DPoint& rCurr, const B2DPoint& rNext, const B2DPolygon& rPointPolygon, + const B2DPoint& rCurr, const B2DPoint& rNext, const B2DPolygon& rPointPolygon, sal_uInt32 nInd, temporaryPointVector& rTempPoints) { // find out if points from rPointPolygon are positioned on given edge. If Yes, add // points there to represent touches (which may be enter or leave nodes later). const sal_uInt32 nPointCount(rPointPolygon.count()); - + if(nPointCount) { const B2DRange aRange(rCurr, rNext); @@ -668,7 +668,7 @@ namespace basegfx B2DVector aNormalizedEdgeVector(aEdgeVector); aNormalizedEdgeVector.normalize(); bool bTestUsingX(fabs(aEdgeVector.getX()) > fabs(aEdgeVector.getY())); - + for(sal_uInt32 a(0L); a < nPointCount; a++) { const B2DPoint aTestPoint(rPointPolygon.getB2DPoint(a)); @@ -681,7 +681,7 @@ namespace basegfx if(areParallel(aNormalizedEdgeVector, aTestVector)) { - const double fCut((bTestUsingX) + const double fCut((bTestUsingX) ? aTestVector.getX() / aEdgeVector.getX() : aTestVector.getY() / aEdgeVector.getY()); const double fZero(0.0); @@ -701,7 +701,7 @@ namespace basegfx //////////////////////////////////////////////////////////////////////////////// void findTouchesOnCurve( - const B2DCubicBezier& rCubicA, const B2DPolygon& rPointPolygon, + const B2DCubicBezier& rCubicA, const B2DPolygon& rPointPolygon, sal_uInt32 nInd, temporaryPointVector& rTempPoints) { // find all points from rPointPolygon which touch the given bezier segment. Add an entry @@ -712,7 +712,7 @@ namespace basegfx // create subdivided polygon and find cuts on it // Keep adaptiveSubdivideByCount due to needed quality - aTempPolygon.reserve(SUBDIVIDE_FOR_CUT_TEST_COUNT + 8); + aTempPolygon.reserve(SUBDIVIDE_FOR_CUT_TEST_COUNT + 8); aTempPolygon.append(rCubicA.getStartPoint()); rCubicA.adaptiveSubdivideByCount(aTempPolygon, SUBDIVIDE_FOR_CUT_TEST_COUNT); findTouches(aTempPolygon, rPointPolygon, aTempPointVector); @@ -788,7 +788,7 @@ namespace basegfx void findCuts(const B2DPolygon& rCandidateA, const B2DPolygon& rCandidateB, temporaryPointVector& rTempPointsA, temporaryPointVector& rTempPointsB) { - // find out if edges from both polygons cut. If so, add entries to rTempPoints which + // find out if edges from both polygons cut. If so, add entries to rTempPoints which // should be added to the polygons accordingly const sal_uInt32 nPointCountA(rCandidateA.count()); const sal_uInt32 nPointCountB(rCandidateB.count()); @@ -847,7 +847,7 @@ namespace basegfx else { // test for simple edge-edge cuts - findEdgeCutsTwoEdges(aCubicA.getStartPoint(), aCubicA.getEndPoint(), aCubicB.getStartPoint(), aCubicB.getEndPoint(), + findEdgeCutsTwoEdges(aCubicA.getStartPoint(), aCubicA.getEndPoint(), aCubicB.getStartPoint(), aCubicB.getEndPoint(), a, b, rTempPointsA, rTempPointsB); } } @@ -911,7 +911,7 @@ namespace basegfx if(rCandidate.count()) { temporaryPointVector aTempPoints; - + findTouches(rCandidate, rCandidate, aTempPoints); findCuts(rCandidate, aTempPoints); @@ -1016,11 +1016,11 @@ namespace basegfx { temporaryPointVector aTempPoints; temporaryPointVector aTempPointsUnused; - + for(sal_uInt32 a(0L); a < rMask.count(); a++) { const B2DPolygon aPartMask(rMask.getB2DPolygon(a)); - + findTouches(rCandidate, aPartMask, aTempPoints); findCuts(rCandidate, aPartMask, aTempPoints, aTempPointsUnused); } @@ -1052,7 +1052,7 @@ namespace basegfx B2DPolygon addPointsAtCuts(const B2DPolygon& rCandidate, const B2DPoint& rStart, const B2DPoint& rEnd) { const sal_uInt32 nCount(rCandidate.count()); - + if(nCount && !rStart.equal(rEnd)) { const B2DRange aPolygonRange(rCandidate.getB2DRange()); @@ -1114,7 +1114,7 @@ namespace basegfx { const sal_uInt32 nCountA(rCandidate.count()); const sal_uInt32 nCountM(rPolyMask.count()); - + if(nCountA && nCountM) { const B2DRange aRangeA(rCandidate.getB2DRange()); @@ -1208,7 +1208,7 @@ namespace basegfx if(rCandidate.count()) { temporaryPointVector aTempPoints; - + findCuts(rCandidate, aTempPoints); return mergeTemporaryPointsAndPolygon(rCandidate, aTempPoints); |