From a96d7ce3904f4dfd08d47170e926b15b5f7dae3d Mon Sep 17 00:00:00 2001 From: Alexander Wilms Date: Tue, 25 Feb 2014 17:40:34 +0100 Subject: Remove visual noise from basegfx Change-Id: I9a28405ab92605203ec380f89f5aee91f042d91a --- basegfx/source/color/bcolormodifier.cxx | 20 ++--- basegfx/source/color/bcolortools.cxx | 2 +- basegfx/source/curve/b2dbeziertools.cxx | 2 +- basegfx/source/curve/b2dcubicbezier.cxx | 8 +- basegfx/source/matrix/b2dhommatrix.cxx | 2 +- basegfx/source/matrix/b2dhommatrixtools.cxx | 2 +- basegfx/source/point/b2dpoint.cxx | 2 +- basegfx/source/polygon/b2dlinegeometry.cxx | 4 +- basegfx/source/polygon/b2dpolygon.cxx | 14 ++-- basegfx/source/polygon/b2dpolygonclipper.cxx | 36 ++++----- basegfx/source/polygon/b2dpolygoncutandtouch.cxx | 60 +++++++-------- basegfx/source/polygon/b2dpolygontools.cxx | 8 +- basegfx/source/polygon/b2dpolygontriangulator.cxx | 8 +- basegfx/source/polygon/b2dpolypolygon.cxx | 4 +- basegfx/source/polygon/b2dpolypolygoncutter.cxx | 32 ++++---- basegfx/source/polygon/b2dpolypolygontools.cxx | 16 ++-- basegfx/source/polygon/b2dsvgpolypolygon.cxx | 6 +- basegfx/source/polygon/b2dtrapezoid.cxx | 24 +++--- basegfx/source/polygon/b3dpolygon.cxx | 14 ++-- basegfx/source/polygon/b3dpolygontools.cxx | 4 +- basegfx/source/polygon/b3dpolypolygon.cxx | 4 +- basegfx/source/polygon/b3dpolypolygontools.cxx | 6 +- basegfx/source/range/b2drangeclipper.cxx | 8 +- basegfx/source/raster/rasterconvert3d.cxx | 2 +- basegfx/source/tools/unotools.cxx | 2 +- basegfx/source/vector/b3dvector.cxx | 2 +- basegfx/source/workbench/bezierclip.cxx | 92 +++++++++++------------ basegfx/test/basegfx2d.cxx | 10 +-- 28 files changed, 193 insertions(+), 201 deletions(-) (limited to 'basegfx') diff --git a/basegfx/source/color/bcolormodifier.cxx b/basegfx/source/color/bcolormodifier.cxx index c1f70267769c..ae0fdee7ded4 100644 --- a/basegfx/source/color/bcolormodifier.cxx +++ b/basegfx/source/color/bcolormodifier.cxx @@ -19,7 +19,7 @@ #include -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { @@ -28,7 +28,7 @@ namespace basegfx } } // end of namespace basegfx -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { @@ -49,7 +49,7 @@ namespace basegfx } } // end of namespace basegfx -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { @@ -68,7 +68,7 @@ namespace basegfx } } // end of namespace basegfx -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { @@ -89,7 +89,7 @@ namespace basegfx } } // end of namespace basegfx -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { @@ -115,7 +115,7 @@ namespace basegfx } } // end of namespace basegfx -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { @@ -141,7 +141,7 @@ namespace basegfx } } // end of namespace basegfx -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { @@ -176,7 +176,7 @@ namespace basegfx } } // end of namespace basegfx -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { @@ -228,7 +228,7 @@ namespace basegfx } } // end of namespace basegfx -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { @@ -311,7 +311,7 @@ namespace basegfx } } // end of namespace basegfx -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { diff --git a/basegfx/source/color/bcolortools.cxx b/basegfx/source/color/bcolortools.cxx index 838a10d1a116..400eb910d16c 100644 --- a/basegfx/source/color/bcolortools.cxx +++ b/basegfx/source/color/bcolortools.cxx @@ -21,7 +21,7 @@ #include #include -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { namespace tools { diff --git a/basegfx/source/curve/b2dbeziertools.cxx b/basegfx/source/curve/b2dbeziertools.cxx index 153b3c702cf3..e7d77ce89c0f 100644 --- a/basegfx/source/curve/b2dbeziertools.cxx +++ b/basegfx/source/curve/b2dbeziertools.cxx @@ -21,7 +21,7 @@ #include #include -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { diff --git a/basegfx/source/curve/b2dcubicbezier.cxx b/basegfx/source/curve/b2dcubicbezier.cxx index 8ab5e2d7dca0..6533752fa38b 100644 --- a/basegfx/source/curve/b2dcubicbezier.cxx +++ b/basegfx/source/curve/b2dcubicbezier.cxx @@ -30,7 +30,7 @@ static double fMultFactUnsharpen = FACTOR_FOR_UNSHARPEN; #endif -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { @@ -268,10 +268,10 @@ namespace basegfx // Perform bezier flatness test (lecture notes from R. Schaback, // Mathematics of Computer-Aided Design, Uni Goettingen, 2000) - // + // ||P(t) - L(t)|| <= max ||b_j - b_0 - j/n(b_n - b_0)|| // 0<=j<=n - // + // What is calculated here is an upper bound to the distance from // a line through b_0 and b_3 (rfPA and P4 in our notation) and the // curve. We can drop 0 and n from the running indices, since the @@ -323,7 +323,7 @@ namespace basegfx } // end of anonymous namespace } // end of namespace basegfx -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { diff --git a/basegfx/source/matrix/b2dhommatrix.cxx b/basegfx/source/matrix/b2dhommatrix.cxx index 7b76d075399f..936817e54d3c 100644 --- a/basegfx/source/matrix/b2dhommatrix.cxx +++ b/basegfx/source/matrix/b2dhommatrix.cxx @@ -25,7 +25,7 @@ #include #include -/////////////////////////////////////////////////////////////////////////////// + namespace basegfx { diff --git a/basegfx/source/matrix/b2dhommatrixtools.cxx b/basegfx/source/matrix/b2dhommatrixtools.cxx index 3e39fd5e4df6..33a9231db4e4 100644 --- a/basegfx/source/matrix/b2dhommatrixtools.cxx +++ b/basegfx/source/matrix/b2dhommatrixtools.cxx @@ -21,7 +21,7 @@ #include #include -/////////////////////////////////////////////////////////////////////////////// + namespace basegfx { diff --git a/basegfx/source/point/b2dpoint.cxx b/basegfx/source/point/b2dpoint.cxx index bb2bbe16af72..9e40b6a21838 100644 --- a/basegfx/source/point/b2dpoint.cxx +++ b/basegfx/source/point/b2dpoint.cxx @@ -21,7 +21,7 @@ #include #include -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { diff --git a/basegfx/source/polygon/b2dlinegeometry.cxx b/basegfx/source/polygon/b2dlinegeometry.cxx index 0532ee175e4b..35d98a27b653 100644 --- a/basegfx/source/polygon/b2dlinegeometry.cxx +++ b/basegfx/source/polygon/b2dlinegeometry.cxx @@ -31,7 +31,7 @@ #include #include -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { @@ -130,7 +130,7 @@ namespace basegfx } // end of namespace tools } // end of namespace basegfx -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { diff --git a/basegfx/source/polygon/b2dpolygon.cxx b/basegfx/source/polygon/b2dpolygon.cxx index a24cab41edcb..4aa2ad492857 100644 --- a/basegfx/source/polygon/b2dpolygon.cxx +++ b/basegfx/source/polygon/b2dpolygon.cxx @@ -29,7 +29,7 @@ #include #include -////////////////////////////////////////////////////////////////////////////// + struct CoordinateData2D : public basegfx::B2DPoint { @@ -52,7 +52,7 @@ public: } }; -////////////////////////////////////////////////////////////////////////////// + class CoordinateDataArray2D { @@ -238,7 +238,7 @@ public: } }; -////////////////////////////////////////////////////////////////////////////// + class ControlVectorPair2D { @@ -281,7 +281,7 @@ public: } }; -////////////////////////////////////////////////////////////////////////////// + class ControlVectorArray2D { @@ -509,7 +509,7 @@ public: } }; -////////////////////////////////////////////////////////////////////////////// + class ImplBufferedData { @@ -605,7 +605,7 @@ public: } }; -////////////////////////////////////////////////////////////////////////////// + class ImplB2DPolygon { @@ -1183,7 +1183,7 @@ public: } }; -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { diff --git a/basegfx/source/polygon/b2dpolygonclipper.cxx b/basegfx/source/polygon/b2dpolygonclipper.cxx index 2cf7c30eb1de..817a43955900 100644 --- a/basegfx/source/polygon/b2dpolygonclipper.cxx +++ b/basegfx/source/polygon/b2dpolygonclipper.cxx @@ -29,7 +29,7 @@ #include #include -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { @@ -337,7 +337,7 @@ namespace basegfx return aRetval; } - ////////////////////////////////////////////////////////////////////////////// + B2DPolyPolygon clipPolyPolygonOnPolyPolygon(const B2DPolyPolygon& rCandidate, const B2DPolyPolygon& rClip, bool bInside, bool bStroke) { @@ -461,7 +461,7 @@ namespace basegfx return aRetval; } - ////////////////////////////////////////////////////////////////////////////// + B2DPolyPolygon clipPolygonOnPolyPolygon(const B2DPolygon& rCandidate, const B2DPolyPolygon& rClip, bool bInside, bool bStroke) { @@ -475,7 +475,7 @@ namespace basegfx return aRetval; } - ////////////////////////////////////////////////////////////////////////////// + /* * let a plane be defined as @@ -619,16 +619,12 @@ namespace basegfx if(nVertexCount) { - //////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////// - // // Upper bound for the maximal number of vertices when intersecting an // axis-aligned rectangle with a triangle in E2 - // + // The rectangle and the triangle are in general position, and have 4 and 3 // vertices, respectively. - // + // Lemma: Since the rectangle is a convex polygon ( see // http://mathworld.wolfram.com/ConvexPolygon.html for a definition), and // has no holes, it follows that any straight line will intersect the @@ -640,7 +636,7 @@ namespace basegfx // other 'outside') will at utmost add _one_ vertex to the resulting // intersection polygon (adding two intersection vertices, and removing at // least one rectangle vertex): - // + // * // +--+-----------------+ // | * | @@ -649,7 +645,7 @@ namespace basegfx // *| | // * | | // +--------------------+ - // + // Proof: If the straight line intersects the rectangle two // times, it does so for distinct edges, i.e. the intersection has // minimally one of the rectangle's vertices on either side of the straight @@ -657,17 +653,17 @@ namespace basegfx // minimally _one_ rectangle vertex removed from the resulting clip // polygon, and therefore, a clip against a half-plane has the net effect // of adding at utmost _one_ vertex to the resulting clip polygon. - // + // Theorem: The intersection of a rectangle and a triangle results in a // polygon with at utmost 7 vertices. - // + // Proof: The inside of the triangle can be described as the consecutive // intersection with three half-planes. Together with the lemma above, this // results in at utmost 3 additional vertices added to the already existing 4 // rectangle vertices. - // + // This upper bound is attained with the following example configuration: - // + // * // *** // ** * @@ -689,7 +685,7 @@ namespace basegfx // --*6-----5----- // ** * // ** - // + // As we need to scissor all triangles against the // output rectangle we employ an output buffer for the // resulting vertices. the question is how large this @@ -707,10 +703,6 @@ namespace basegfx // fan. for the maximum number of 7 vertices of // resulting triangle fans we therefore need 15 times // the number of original vertices. - // - //////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////// //const size_t nBufferSize = sizeof(vertex)*(nVertexCount*16); //vertex *pVertices = (vertex*)alloca(nBufferSize); @@ -787,7 +779,7 @@ namespace basegfx return aResult; } - ////////////////////////////////////////////////////////////////////////////// + } // end of namespace tools } // end of namespace basegfx diff --git a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx index 3919a75bcac1..37fa50cd8b63 100644 --- a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx +++ b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx @@ -33,13 +33,13 @@ #define SUBDIVIDE_FOR_CUT_TEST_COUNT (50) -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { namespace { - //////////////////////////////////////////////////////////////////////////////// + class temporaryPoint { @@ -70,11 +70,11 @@ namespace basegfx double getCut() const { return mfCut; } }; - //////////////////////////////////////////////////////////////////////////////// + typedef ::std::vector< temporaryPoint > temporaryPointVector; - //////////////////////////////////////////////////////////////////////////////// + class temporaryPolygonData { @@ -89,7 +89,7 @@ namespace basegfx temporaryPointVector& getTemporaryPointVector() { return maPoints; } }; - //////////////////////////////////////////////////////////////////////////////// + B2DPolygon mergeTemporaryPointsAndPolygon(const B2DPolygon& rCandidate, temporaryPointVector& rTempPoints) { @@ -180,7 +180,7 @@ namespace basegfx } } - //////////////////////////////////////////////////////////////////////////////// + void adaptAndTransferCutsWithBezierSegment( const temporaryPointVector& rPointVector, const B2DPolygon& rPolygon, @@ -205,25 +205,25 @@ namespace basegfx } } - //////////////////////////////////////////////////////////////////////////////// + } // end of anonymous namespace } // end of namespace basegfx -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { namespace { - //////////////////////////////////////////////////////////////////////////////// + // predefines for calls to this methods before method implementation void findCuts(const B2DPolygon& rCandidate, temporaryPointVector& rTempPoints); void findTouches(const B2DPolygon& rEdgePolygon, const B2DPolygon& rPointPolygon, temporaryPointVector& rTempPoints); void findCuts(const B2DPolygon& rCandidateA, const B2DPolygon& rCandidateB, temporaryPointVector& rTempPointsA, temporaryPointVector& rTempPointsB); - //////////////////////////////////////////////////////////////////////////////// + void findEdgeCutsTwoEdges( const B2DPoint& rCurrA, const B2DPoint& rNextA, @@ -277,7 +277,7 @@ namespace basegfx } } - //////////////////////////////////////////////////////////////////////////////// + void findCutsAndTouchesAndCommonForBezier(const B2DPolygon& rCandidateA, const B2DPolygon& rCandidateB, temporaryPointVector& rTempPointsA, temporaryPointVector& rTempPointsB) { @@ -399,7 +399,7 @@ namespace basegfx } } - //////////////////////////////////////////////////////////////////////////////// + void findEdgeCutsBezierAndEdge( const B2DCubicBezier& rCubicA, @@ -440,7 +440,7 @@ namespace basegfx } } - //////////////////////////////////////////////////////////////////////////////// + void findEdgeCutsTwoBeziers( const B2DCubicBezier& rCubicA, @@ -481,7 +481,7 @@ namespace basegfx } } - //////////////////////////////////////////////////////////////////////////////// + void findEdgeCutsOneBezier( const B2DCubicBezier& rCubicA, @@ -514,7 +514,7 @@ namespace basegfx } } - //////////////////////////////////////////////////////////////////////////////// + void findCuts(const B2DPolygon& rCandidate, temporaryPointVector& rTempPoints) { @@ -627,18 +627,18 @@ namespace basegfx } } - //////////////////////////////////////////////////////////////////////////////// + } // end of anonymous namespace } // end of namespace basegfx -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { namespace { - //////////////////////////////////////////////////////////////////////////////// + void findTouchesOnEdge( const B2DPoint& rCurr, const B2DPoint& rNext, const B2DPolygon& rPointPolygon, @@ -685,7 +685,7 @@ namespace basegfx } } - //////////////////////////////////////////////////////////////////////////////// + void findTouchesOnCurve( const B2DCubicBezier& rCubicA, const B2DPolygon& rPointPolygon, @@ -711,7 +711,7 @@ namespace basegfx } } - //////////////////////////////////////////////////////////////////////////////// + void findTouches(const B2DPolygon& rEdgePolygon, const B2DPolygon& rPointPolygon, temporaryPointVector& rTempPoints) { @@ -760,18 +760,18 @@ namespace basegfx } } - //////////////////////////////////////////////////////////////////////////////// + } // end of anonymous namespace } // end of namespace basegfx -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { namespace { - //////////////////////////////////////////////////////////////////////////////// + void findCuts(const B2DPolygon& rCandidateA, const B2DPolygon& rCandidateB, temporaryPointVector& rTempPointsA, temporaryPointVector& rTempPointsB) { @@ -880,18 +880,18 @@ namespace basegfx } } - //////////////////////////////////////////////////////////////////////////////// + } // end of anonymous namespace } // end of namespace basegfx -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { namespace tools { - //////////////////////////////////////////////////////////////////////////////// + B2DPolygon addPointsAtCutsAndTouches(const B2DPolygon& rCandidate) { @@ -910,7 +910,7 @@ namespace basegfx } } - //////////////////////////////////////////////////////////////////////////////// + B2DPolyPolygon addPointsAtCutsAndTouches(const B2DPolyPolygon& rCandidate, bool bSelfIntersections) { @@ -995,7 +995,7 @@ namespace basegfx } } - //////////////////////////////////////////////////////////////////////////////// + B2DPolygon addPointsAtCuts(const B2DPolygon& rCandidate, const B2DPoint& rStart, const B2DPoint& rEnd) { @@ -1044,7 +1044,7 @@ namespace basegfx return rCandidate; } - //////////////////////////////////////////////////////////////////////////////// + B2DPolygon addPointsAtCuts(const B2DPolygon& rCandidate, const B2DPolyPolygon& rPolyMask) { @@ -1127,7 +1127,7 @@ namespace basegfx return rCandidate; } - //////////////////////////////////////////////////////////////////////////////// + } // end of namespace tools } // end of namespace basegfx diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx index a931edf41638..5a3dfcd4c076 100644 --- a/basegfx/source/polygon/b2dpolygontools.cxx +++ b/basegfx/source/polygon/b2dpolygontools.cxx @@ -45,7 +45,7 @@ static double fAngleBoundStartValue = ANGLE_BOUND_START_VALUE; #endif #define STEPSPERQUARTER (3) -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { @@ -3133,7 +3133,7 @@ namespace basegfx return aRetval; } - ////////////////////////////////////////////////////////////////////// + // comparators with tolerance for 2D Polygons bool equal(const B2DPolygon& rCandidateA, const B2DPolygon& rCandidateB, const double& rfSmallValue) @@ -3352,7 +3352,7 @@ namespace basegfx return aRetval; } - ////////////////////////////////////////////////////////////////////////////// + // converters for com::sun::star::drawing::PointSequence B2DPolygon UnoPointSequenceToB2DPolygon( @@ -3428,7 +3428,7 @@ namespace basegfx } } - ////////////////////////////////////////////////////////////////////////////// + // converters for com::sun::star::drawing::PointSequence and // com::sun::star::drawing::FlagSequence to B2DPolygon (curved polygons) diff --git a/basegfx/source/polygon/b2dpolygontriangulator.cxx b/basegfx/source/polygon/b2dpolygontriangulator.cxx index 811ee607bb9c..bd5d96e6aba7 100644 --- a/basegfx/source/polygon/b2dpolygontriangulator.cxx +++ b/basegfx/source/polygon/b2dpolygontriangulator.cxx @@ -29,7 +29,7 @@ #include -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { @@ -110,12 +110,12 @@ namespace basegfx void setNext(EdgeEntry* pNext) { mpNext = pNext; } }; - ////////////////////////////////////////////////////////////////////////////// + typedef ::std::vector< EdgeEntry > EdgeEntries; typedef ::std::vector< EdgeEntry* > EdgeEntryPointers; - ////////////////////////////////////////////////////////////////////////////// + class Triangulator { @@ -389,7 +389,7 @@ namespace basegfx } // end of anonymous namespace } // end of namespace basegfx -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { diff --git a/basegfx/source/polygon/b2dpolypolygon.cxx b/basegfx/source/polygon/b2dpolypolygon.cxx index 7075782fe843..40abbc4c5128 100644 --- a/basegfx/source/polygon/b2dpolypolygon.cxx +++ b/basegfx/source/polygon/b2dpolypolygon.cxx @@ -27,7 +27,7 @@ #include #include -////////////////////////////////////////////////////////////////////////////// + class ImplB2DPolyPolygon { @@ -175,7 +175,7 @@ public: } }; -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { diff --git a/basegfx/source/polygon/b2dpolypolygoncutter.cxx b/basegfx/source/polygon/b2dpolypolygoncutter.cxx index bc5cfc48efd0..47cda51e0db5 100644 --- a/basegfx/source/polygon/b2dpolypolygoncutter.cxx +++ b/basegfx/source/polygon/b2dpolypolygoncutter.cxx @@ -31,13 +31,13 @@ #include #include -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { namespace { - ////////////////////////////////////////////////////////////////////////////// + struct StripHelper { @@ -46,7 +46,7 @@ namespace basegfx B2VectorOrientation meOrinetation; }; - ////////////////////////////////////////////////////////////////////////////// + struct PN { @@ -57,7 +57,7 @@ namespace basegfx sal_uInt32 mnIN; }; - ////////////////////////////////////////////////////////////////////////////// + struct VN { @@ -72,7 +72,7 @@ namespace basegfx B2DVector maOriginalNext; }; - ////////////////////////////////////////////////////////////////////////////// + struct SN { @@ -99,7 +99,7 @@ namespace basegfx } }; - ////////////////////////////////////////////////////////////////////////////// + typedef ::std::vector< PN > PNV; typedef ::std::vector< VN > VNV; @@ -107,7 +107,7 @@ namespace basegfx typedef ::std::pair< basegfx::B2DPoint /*orig*/, basegfx::B2DPoint /*repl*/ > CorrectionPair; typedef ::std::vector< CorrectionPair > CorrectionTable; - ////////////////////////////////////////////////////////////////////////////// + class solver { @@ -691,18 +691,18 @@ namespace basegfx } }; - ////////////////////////////////////////////////////////////////////////////// + } // end of anonymous namespace } // end of namespace basegfx -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { namespace tools { - ////////////////////////////////////////////////////////////////////////////// + B2DPolyPolygon solveCrossovers(const B2DPolyPolygon& rCandidate) { @@ -717,7 +717,7 @@ namespace basegfx } } - ////////////////////////////////////////////////////////////////////////////// + B2DPolyPolygon solveCrossovers(const B2DPolygon& rCandidate) { @@ -725,7 +725,7 @@ namespace basegfx return aSolver.getB2DPolyPolygon(); } - ////////////////////////////////////////////////////////////////////////////// + B2DPolyPolygon stripNeutralPolygons(const B2DPolyPolygon& rCandidate) { @@ -744,7 +744,7 @@ namespace basegfx return aRetval; } - ////////////////////////////////////////////////////////////////////////////// + B2DPolyPolygon createNonzeroConform(const B2DPolyPolygon& rCandidate) { @@ -832,7 +832,7 @@ namespace basegfx return aCandidate; } - ////////////////////////////////////////////////////////////////////////////// + B2DPolyPolygon stripDispensablePolygons(const B2DPolyPolygon& rCandidate, bool bKeepAboveZero) { @@ -936,7 +936,7 @@ namespace basegfx return aRetval; } - ////////////////////////////////////////////////////////////////////////////// + B2DPolyPolygon prepareForPolygonOperation(const B2DPolygon& rCandidate) { @@ -1134,7 +1134,7 @@ namespace basegfx return B2DPolyPolygon(); } - ////////////////////////////////////////////////////////////////////////////// + } // end of namespace tools } // end of namespace basegfx diff --git a/basegfx/source/polygon/b2dpolypolygontools.cxx b/basegfx/source/polygon/b2dpolypolygontools.cxx index f1ba12b67663..d7b2b5fb236d 100644 --- a/basegfx/source/polygon/b2dpolypolygontools.cxx +++ b/basegfx/source/polygon/b2dpolypolygontools.cxx @@ -26,7 +26,7 @@ #include #include -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { @@ -533,15 +533,15 @@ namespace basegfx const double fBottom=fTotalSize; // from 0 to 5: pair of segment corner coordinates - // + // segment corner indices are these: - // + // 0 - 1 // | | // 2 - 3 // | | // 4 - 5 - // + static const double corners[] = { fLeft, fTop, @@ -553,7 +553,7 @@ namespace basegfx }; // from 0 to 9: which segments are 'lit' for this number? - // + // array denotes graph edges to traverse, with -1 means // stop (the vertices are the corner indices from above): // 0 @@ -563,7 +563,7 @@ namespace basegfx // 4 | | 5 // - // 6 - // + static const int numbers[] = { 1, 1, 1, 0, 1, 1, 1, // 0 @@ -647,7 +647,7 @@ namespace basegfx return aRes; } - ////////////////////////////////////////////////////////////////////////////// + // converters for com::sun::star::drawing::PointSequence B2DPolyPolygon UnoPointSequenceSequenceToB2DPolyPolygon( @@ -692,7 +692,7 @@ namespace basegfx } } - ////////////////////////////////////////////////////////////////////////////// + // converters for com::sun::star::drawing::PolyPolygonBezierCoords (curved polygons) B2DPolyPolygon UnoPolyPolygonBezierCoordsToB2DPolyPolygon( diff --git a/basegfx/source/polygon/b2dsvgpolypolygon.cxx b/basegfx/source/polygon/b2dsvgpolypolygon.cxx index 62e70144a3aa..8eec134c0ca1 100644 --- a/basegfx/source/polygon/b2dsvgpolypolygon.cxx +++ b/basegfx/source/polygon/b2dsvgpolypolygon.cxx @@ -747,11 +747,11 @@ namespace basegfx // existing continuity since no 'S' or 's' statement should be written. At // import, that 'previous' control vector is not available. SVG documentation // says for interpretation: - // + // "(If there is no previous command or if the previous command was // not an C, c, S or s, assume the first control point is coincident // with the current point.)" - // + // That's what is done from our import, so avoid exporting it as first statement // is necessary. const bool bSymmetricAtEdgeStart( @@ -764,7 +764,7 @@ namespace basegfx // the case if both control points are in // the same place when they are prolonged // to the common quadratic control point - // + // Left: P = (3P1 - P0) / 2 // Right: P = (3P2 - P3) / 2 aLeft = B2DPoint((3.0 * aControlEdgeStart - aEdgeStart) / 2.0); diff --git a/basegfx/source/polygon/b2dtrapezoid.cxx b/basegfx/source/polygon/b2dtrapezoid.cxx index 6c9895953a2e..35eab940a0db 100644 --- a/basegfx/source/polygon/b2dtrapezoid.cxx +++ b/basegfx/source/polygon/b2dtrapezoid.cxx @@ -22,13 +22,13 @@ #include #include -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { namespace trapezoidhelper { - ////////////////////////////////////////////////////////////////////////////// + // helper class to hold a simple ege. This is only used for horizontal edges // currently, thus the YPositions will be equal. I did not create a special // class for this since holdingthe pointers is more effective and also can be @@ -56,12 +56,12 @@ namespace basegfx const B2DPoint& getEnd() const { return *mpEnd; } }; - ////////////////////////////////////////////////////////////////////////////// + // define vector of simple edges typedef ::std::vector< TrDeSimpleEdge > TrDeSimpleEdges; - ////////////////////////////////////////////////////////////////////////////// + // helper class for holding a traversing edge. It will always have some // distance in YPos. The slope (in a numerically useful form, see comments) is // hold and used in SortValue to allow sorting traversing edges by Y, X and slope @@ -179,7 +179,7 @@ namespace basegfx } }; - ////////////////////////////////////////////////////////////////////////////// + // define double linked list of edges (for fast random insert) typedef ::std::list< TrDeEdgeEntry > TrDeEdgeEntries; @@ -187,7 +187,7 @@ namespace basegfx } // end of anonymous namespace } // end of namespace basegfx -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { @@ -600,22 +600,22 @@ namespace basegfx // This is the central subdivider. The strategy is to use the first two entries // from the traversing edges as a potential trapezoid and do the needed corrections // and adaptions on the way. - // + // There always must be two edges with the same YStart value: When adding the polygons // in the constructor, there is always a topmost point from which two edges start; when // the topmost is an edge, there is a start and end of this edge from which two edges // start. All cases have two edges with same StartY (QED). - // + // Based on this these edges get corrected when: // - one is longer than the other // - they intersect // - they intersect with other edges // - another edge starts inside the thought trapezoid - // + // All this cases again produce a valid state so that the first two edges have a common // Ystart again. Some cases lead to a restart of the process, some allow consuming the // edges and create the intended trapezoid. - // + // Be careful when doing chages here: It is essential to keep all possible paths // in valid states and to be numerically correct. This is especially needed e.g. // by using fTools::equal(..) in the more robust small-value incarnation. @@ -898,7 +898,7 @@ namespace basegfx } // end of anonymous namespace } // end of namespace basegfx -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { @@ -951,7 +951,7 @@ namespace basegfx } } // end of namespace basegfx -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { diff --git a/basegfx/source/polygon/b3dpolygon.cxx b/basegfx/source/polygon/b3dpolygon.cxx index 24fe3f0fd82d..9e409804e343 100644 --- a/basegfx/source/polygon/b3dpolygon.cxx +++ b/basegfx/source/polygon/b3dpolygon.cxx @@ -28,7 +28,7 @@ #include #include -////////////////////////////////////////////////////////////////////////////// + class CoordinateData3D { @@ -67,7 +67,7 @@ public: } }; -////////////////////////////////////////////////////////////////////////////// + class CoordinateDataArray3D { @@ -249,7 +249,7 @@ public: } }; -////////////////////////////////////////////////////////////////////////////// + class BColorArray { @@ -414,7 +414,7 @@ public: } }; -////////////////////////////////////////////////////////////////////////////// + class NormalsArray3D { @@ -588,7 +588,7 @@ public: } }; -////////////////////////////////////////////////////////////////////////////// + class TextureCoordinate2D { @@ -762,7 +762,7 @@ public: } }; -////////////////////////////////////////////////////////////////////////////// + class ImplB3DPolygon { @@ -1520,7 +1520,7 @@ public: } }; -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { diff --git a/basegfx/source/polygon/b3dpolygontools.cxx b/basegfx/source/polygon/b3dpolygontools.cxx index 56268d254820..4dd773408508 100644 --- a/basegfx/source/polygon/b3dpolygontools.cxx +++ b/basegfx/source/polygon/b3dpolygontools.cxx @@ -29,7 +29,7 @@ #include #include -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { @@ -734,7 +734,7 @@ namespace basegfx return false; } - ////////////////////////////////////////////////////////////////////// + // comparators with tolerance for 3D Polygons bool equal(const B3DPolygon& rCandidateA, const B3DPolygon& rCandidateB, const double& rfSmallValue) diff --git a/basegfx/source/polygon/b3dpolypolygon.cxx b/basegfx/source/polygon/b3dpolypolygon.cxx index 3fc6d7b13a37..b237bccacc7a 100644 --- a/basegfx/source/polygon/b3dpolypolygon.cxx +++ b/basegfx/source/polygon/b3dpolypolygon.cxx @@ -27,7 +27,7 @@ #include #include -////////////////////////////////////////////////////////////////////////////// + class ImplB3DPolyPolygon { @@ -210,7 +210,7 @@ public: } }; -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { diff --git a/basegfx/source/polygon/b3dpolypolygontools.cxx b/basegfx/source/polygon/b3dpolypolygontools.cxx index 83241d8bfa87..33c0c67f0768 100644 --- a/basegfx/source/polygon/b3dpolypolygontools.cxx +++ b/basegfx/source/polygon/b3dpolypolygontools.cxx @@ -28,12 +28,12 @@ #include #include -////////////////////////////////////////////////////////////////////////////// + // predefines #define nMinSegments sal_uInt32(1) #define nMaxSegments sal_uInt32(512) -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { @@ -484,7 +484,7 @@ namespace basegfx } } - ////////////////////////////////////////////////////////////////////// + // comparators with tolerance for 3D PolyPolygons bool equal(const B3DPolyPolygon& rCandidateA, const B3DPolyPolygon& rCandidateB, const double& rfSmallValue) diff --git a/basegfx/source/range/b2drangeclipper.cxx b/basegfx/source/range/b2drangeclipper.cxx index c29b26cefbad..33a81beaecce 100644 --- a/basegfx/source/range/b2drangeclipper.cxx +++ b/basegfx/source/range/b2drangeclipper.cxx @@ -40,7 +40,7 @@ namespace basegfx namespace { // Generating a poly-polygon from a bunch of rectangles - // + // Helper functionality for sweep-line algorithm // ==================================================== @@ -882,17 +882,17 @@ namespace basegfx // sweep-line algorithm to generate a poly-polygon // from a bunch of rectangles // =============================================== - // + // This algorithm uses the well-known sweep line // concept, explained in every good text book about // computational geometry. - // + // We start with creating two structures for every // rectangle, one representing the left x coordinate, // one representing the right x coordinate (and both // referencing the original rect). These structs are // sorted with increasing x coordinates. - // + // Then, we start processing the resulting list from // the beginning. Every entry in the list defines a // point in time of the line sweeping from left to diff --git a/basegfx/source/raster/rasterconvert3d.cxx b/basegfx/source/raster/rasterconvert3d.cxx index 501bdf93f2e5..5ea062a0e95b 100644 --- a/basegfx/source/raster/rasterconvert3d.cxx +++ b/basegfx/source/raster/rasterconvert3d.cxx @@ -22,7 +22,7 @@ #include #include -////////////////////////////////////////////////////////////////////////////// + // implementations of the 3D raster converter namespace basegfx diff --git a/basegfx/source/tools/unotools.cxx b/basegfx/source/tools/unotools.cxx index fda5f0ad8d3b..d4ff311ea017 100644 --- a/basegfx/source/tools/unotools.cxx +++ b/basegfx/source/tools/unotools.cxx @@ -153,7 +153,7 @@ namespace unotools return aNewPolyPolygon; } - ///////////////////////////////////////////////////////////////////////////////// + void b2DPolyPolygonToPolyPolygonBezier( const basegfx::B2DPolyPolygon& rPolyPoly, drawing::PolyPolygonBezierCoords& rRetval ) diff --git a/basegfx/source/vector/b3dvector.cxx b/basegfx/source/vector/b3dvector.cxx index c8d879418af6..ea8028904a67 100644 --- a/basegfx/source/vector/b3dvector.cxx +++ b/basegfx/source/vector/b3dvector.cxx @@ -20,7 +20,7 @@ #include #include -////////////////////////////////////////////////////////////////////////////// + namespace basegfx { diff --git a/basegfx/source/workbench/bezierclip.cxx b/basegfx/source/workbench/bezierclip.cxx index 2ba7302c7ca5..98cbd085e0e8 100644 --- a/basegfx/source/workbench/bezierclip.cxx +++ b/basegfx/source/workbench/bezierclip.cxx @@ -348,14 +348,14 @@ void Impl_deCasteljauAt( Bezier& part1, double t ) { // deCasteljau bezier arc, scheme is: - // + // First row is C_0^n,C_1^n,...,C_n^n // Second row is P_1^n,...,P_n^n // etc. // with P_k^r = (1 - x_s)P_{k-1}^{r-1} + x_s P_k{r-1} - // + // this results in: - // + // P1 P2 P3 P4 // L1 P2 P3 R4 // L2 H R3 @@ -648,51 +648,51 @@ void Impl_calcFocus( Bezier& res, const Bezier& c ) // calc new curve from hodograph, c and linear blend // Coefficients for derivative of c are (C_i=n(C_{i+1} - C_i)): - // + // 3(P1 - P0), 3(P2 - P1), 3(P3 - P2) (bezier curve of degree 2) - // + // The hodograph is then (bezier curve of 2nd degree is P0(1-t)^2 + 2P1(1-t)t + P2t^2): - // + // 3(P1 - P0)(1-t)^2 + 6(P2 - P1)(1-t)t + 3(P3 - P2)t^2 - // + // rotate by 90 degrees: x=-y, y=x and you get the normal vector function N(t): - // + // x(t) = -(3(P1.y - P0.y)(1-t)^2 + 6(P2.y - P1.y)(1-t)t + 3(P3.y - P2.y)t^2) // y(t) = 3(P1.x - P0.x)(1-t)^2 + 6(P2.x - P1.x)(1-t)t + 3(P3.x - P2.x)t^2 - // + // Now, the focus curve is defined to be F(t)=P(t) + c(t)N(t), // where P(t) is the original curve, and c(t)=c0(1-t) + c1 t - // + // This results in the following expression for F(t): - // + // x(t) = P0.x (1-t)^3 + 3 P1.x (1-t)^2t + 3 P2.x (1.t)t^2 + P3.x t^3 - // (c0(1-t) + c1 t)(3(P1.y - P0.y)(1-t)^2 + 6(P2.y - P1.y)(1-t)t + 3(P3.y - P2.y)t^2) - // + // y(t) = P0.y (1-t)^3 + 3 P1.y (1-t)^2t + 3 P2.y (1.t)t^2 + P3.y t^3 + // (c0(1-t) + c1 t)(3(P1.x - P0.x)(1-t)^2 + 6(P2.x - P1.x)(1-t)t + 3(P3.x - P2.x)t^2) - // + // As a heuristic, we set F(0)=F(1) (thus, the curve is closed and _tends_ to be small): - // + // For F(0), the following results: - // + // x(0) = P0.x - c0 3(P1.y - P0.y) // y(0) = P0.y + c0 3(P1.x - P0.x) - // + // For F(1), the following results: - // + // x(1) = P3.x - c1 3(P3.y - P2.y) // y(1) = P3.y + c1 3(P3.x - P2.x) - // + // Reorder, collect and substitute into F(0)=F(1): - // + // P0.x - c0 3(P1.y - P0.y) = P3.x - c1 3(P3.y - P2.y) // P0.y + c0 3(P1.x - P0.x) = P3.y + c1 3(P3.x - P2.x) - // + // which yields - // + // (P0.y - P1.y)c0 + (P3.y - P2.y)c1 = (P3.x - P0.x)/3 // (P1.x - P0.x)c0 + (P2.x - P3.x)c1 = (P3.y - P0.y)/3 - // + // so, this is what we calculate here (determine c0 and c1): fMatrix[0] = c.p1.x - c.p0.x; @@ -716,7 +716,7 @@ void Impl_calcFocus( Bezier& res, const Bezier& c ) // now, the reordered and per-coefficient collected focus curve is // the following third degree bezier curve F(t): - // + // x(t) = P0.x (1-t)^3 + 3 P1.x (1-t)^2t + 3 P2.x (1.t)t^2 + P3.x t^3 - // (c0(1-t) + c1 t)(3(P1.y - P0.y)(1-t)^2 + 6(P2.y - P1.y)(1-t)t + 3(P3.y - P2.y)t^2) // = P0.x (1-t)^3 + 3 P1.x (1-t)^2t + 3 P2.x (1.t)t^2 + P3.x t^3 - @@ -732,7 +732,7 @@ void Impl_calcFocus( Bezier& res, const Bezier& c ) // 3(P1.x - c1(P1.y - P0.y) - 2c0(P2.y - P1.y))(1-t)^2t + // 3(P2.x - 2 c1(P2.y - P1.y) - c0(P3.y - P2.y))(1-t)t^2 + // (P3.x - 3 c1(P3.y - P2.y))t^3 - // + // y(t) = P0.y (1-t)^3 + 3 P1.y (1-t)^2t + 3 P2.y (1-t)t^2 + P3.y t^3 + // (c0(1-t) + c1 t)(3(P1.x - P0.x)(1-t)^2 + 6(P2.x - P1.x)(1-t)t + 3(P3.x - P2.x)t^2) // = P0.y (1-t)^3 + 3 P1.y (1-t)^2t + 3 P2.y (1-t)t^2 + P3.y t^3 + @@ -742,14 +742,14 @@ void Impl_calcFocus( Bezier& res, const Bezier& c ) // 3(P1.y + 2 c0 (P2.x - P1.x) + c1 (P1.x - P0.x))(1-t)^2t + // 3(P2.y + c0 (P3.x - P2.x) + 2 c1 (P2.x - P1.x))(1-t)t^2 + // (P3.y + 3 c1 (P3.x - P2.x))t^3 - // + // Therefore, the coefficients F0 to F3 of the focus curve are: - // + // F0.x = (P0.x - 3 c0(P1.y - P0.y)) F0.y = (P0.y + 3 c0 (P1.x - P0.x)) // F1.x = (P1.x - c1(P1.y - P0.y) - 2c0(P2.y - P1.y)) F1.y = (P1.y + 2 c0 (P2.x - P1.x) + c1 (P1.x - P0.x)) // F2.x = (P2.x - 2 c1(P2.y - P1.y) - c0(P3.y - P2.y)) F2.y = (P2.y + c0 (P3.x - P2.x) + 2 c1 (P2.x - P1.x)) // F3.x = (P3.x - 3 c1(P3.y - P2.y)) F3.y = (P3.y + 3 c1 (P3.x - P2.x)) - // + res.p0.x = c.p0.x - 3*fRes[0]*(c.p1.y - c.p0.y); res.p1.x = c.p1.x - fRes[1]*(c.p1.y - c.p0.y) - 2*fRes[0]*(c.p2.y - c.p1.y); res.p2.x = c.p2.x - 2*fRes[1]*(c.p2.y - c.p1.y) - fRes[0]*(c.p3.y - c.p2.y); @@ -773,54 +773,54 @@ bool Impl_calcSafeParams_focus( double& t1, // this statement is P'(t)(P(t) - F) = 0, i.e. hodograph P'(t) and // line through P(t) and F are perpendicular. // If you expand this equation, you end up with something like - // + // (\sum_{i=0}^n (P_i - F)B_i^n(t))^T (\sum_{j=0}^{n-1} n(P_{j+1} - P_j)B_j^{n-1}(t)) - // + // Multiplying that out (as the scalar product is linear, we can // extract some terms) yields: - // + // (P_i - F)^T n(P_{j+1} - P_j) B_i^n(t)B_j^{n-1}(t) + ... - // + // If we combine the B_i^n(t)B_j^{n-1}(t) product, we arrive at a // Bernstein polynomial of degree 2n-1, as - // + // \binom{n}{i}(1-t)^{n-i}t^i) \binom{n-1}{j}(1-t)^{n-1-j}t^j) = // \binom{n}{i}\binom{n-1}{j}(1-t)^{2n-1-i-j}t^{i+j} - // + // Thus, with the defining equation for a 2n-1 degree Bernstein // polynomial - // + // \sum_{i=0}^{2n-1} d_i B_i^{2n-1}(t) - // + // the d_i are calculated as follows: - // + // d_i = \sum_{j+k=i, j\in\{0,...,n\}, k\in\{0,...,n-1\}} \frac{\binom{n}{j}\binom{n-1}{k}}{\binom{2n-1}{i}} n (P_{k+1} - P_k)^T(P_j - F) - // - // + + // Okay, but F is now not a single point, but itself a curve // F(u). Thus, for every value of u, we get a different 2n-1 // bezier curve from the above equation. Therefore, we have a // tensor product bezier patch, with the following defining // equation: - // + // d(t,u) = \sum_{i=0}^{2n-1} \sum_{j=0}^m B_i^{2n-1}(t) B_j^{m}(u) d_{ij}, where // d_{ij} = \sum_{k+l=i, l\in\{0,...,n\}, k\in\{0,...,n-1\}} \frac{\binom{n}{l}\binom{n-1}{k}}{\binom{2n-1}{i}} n (P_{k+1} - P_k)^T(P_l - F_j) - // + // as above, only that now F is one of the focus' control points. - // + // Note the difference in the binomial coefficients to the // reference paper, these formulas most probably contained a typo. - // + // To determine, where D(t,u) is _not_ zero (these are the parts // of the curve that don't share normals with the focus and can // thus be safely clipped away), we project D(u,t) onto the // (d(t,u), t) plane, determine the convex hull there and proceed // as for the curve intersection part (projection is orthogonal to // u axis, thus simply throw away u coordinate). - // + // \fallfac are so-called falling factorials (see Concrete // Mathematics, p. 47 for a definition). - // + // now, for tensor product bezier curves, the convex hull property // holds, too. Thus, we simply project the control points (t_{ij}, @@ -828,9 +828,9 @@ bool Impl_calcSafeParams_focus( double& t1, // intersections of the convex hull with the t axis, as for the // bezier clipping case. - // + // calc polygon of control points (t_{ij}, d_{ij}): - // + const int n( 3 ); // cubic bezier curves, as a matter of fact const int i_card( 2*n ); const int j_card( n + 1 ); diff --git a/basegfx/test/basegfx2d.cxx b/basegfx/test/basegfx2d.cxx index ba59c5f01e99..b1497dc4e42d 100644 --- a/basegfx/test/basegfx2d.cxx +++ b/basegfx/test/basegfx2d.cxx @@ -160,17 +160,17 @@ public: aExport = tools::exportToSvgD( aPoly, true, true, false ); // Adaptions for B2DPolygon bezier change (see #i77162#): - // + // The import/export of aPath1 does not reproduce aExport again. This is // correct since aPath1 contains a segment with non-used control points // which gets exported now correctly as 'l' and also a point (#4, index 3) // with C2 continuity which produces a 's' staement now. - // + // The old SVGexport identified nun-used ControlVectors erraneously as bezier segments // because the 2nd vector at the start point was used, even when added // with start point was identical to end point. Exactly for that reason // i reworked the B2DPolygon to use prev, next control points. - // + // so for correct unit test i add the new exported string here as sExportStringSimpleBezier // and compare to it. const char* sExportStringSimpleBezier = @@ -180,7 +180,7 @@ public: CPPUNIT_ASSERT_MESSAGE("exporting bezier polygon to SVG-D", aExport.equalsAscii(sExportStringSimpleBezier)); // Adaptions for B2DPolygon bezier change (see #i77162#): - // + // a 2nd good test is that re-importing of aExport has to create the same // B2DPolPolygon again: B2DPolyPolygon aReImport; @@ -191,7 +191,7 @@ public: aExport = tools::exportToSvgD( aPoly, true, true, false ); // Adaptions for B2DPolygon bezier change (see #i77162#): - // + // same here, the corrected export with the corrected B2DPolygon is simply more efficient, // so i needed to change the compare string. Also adding the re-import comparison below. const char* sExportString1 = -- cgit v1.2.3