1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _BGFX_POLYGON_B2DPOLYGONTOOLS_HXX
25 #define _BGFX_POLYGON_B2DPOLYGONTOOLS_HXX
26 
27 #include <basegfx/point/b2dpoint.hxx>
28 #include <basegfx/vector/b2dvector.hxx>
29 #include <basegfx/range/b2drectangle.hxx>
30 #include <basegfx/polygon/b2dpolypolygon.hxx>
31 #include <basegfx/polygon/b3dpolygon.hxx>
32 #include <vector>
33 
34 //////////////////////////////////////////////////////////////////////////////
35 
36 namespace basegfx
37 {
38 	// predefinitions
39 	class B2DPolygon;
40 	class B2DRange;
41 
42 	namespace tools
43 	{
44 		// B2DPolygon tools
45 
46 		// open/close with point add/remove and control point corrections
47 		void openWithGeometryChange(B2DPolygon& rCandidate);
48 		void closeWithGeometryChange(B2DPolygon& rCandidate);
49 
50 		/**	Check if given polygon is closed.
51 
52         	This is kind of a 'classic' method to support old polygon
53         	definitions.  Those old polygon definitions define the
54         	closed state of the polygon using identical start and
55         	endpoints. This method corrects this (removes double
56         	start/end points) and sets the Closed()-state of the
57         	polygon correctly.
58 		*/
59 		void checkClosed(B2DPolygon& rCandidate);
60 
61 		// Get successor and predecessor indices. Returning the same index means there
62 		// is none. Same for successor.
63 		sal_uInt32 getIndexOfPredecessor(sal_uInt32 nIndex, const B2DPolygon& rCandidate);
64 		sal_uInt32 getIndexOfSuccessor(sal_uInt32 nIndex, const B2DPolygon& rCandidate);
65 
66 		// Get orientation of Polygon
67 		B2VectorOrientation getOrientation(const B2DPolygon& rCandidate);
68 
69 		// isInside tests for B2dPoint and other B2dPolygon. On border is not inside as long as
70 		// not true is given in bWithBorder flag.
71 		bool isInside(const B2DPolygon& rCandidate, const B2DPoint& rPoint, bool bWithBorder = false);
72 		bool isInside(const B2DPolygon& rCandidate, const B2DPolygon& rPolygon, bool bWithBorder = false);
73 
74 		/** Get the range of a polygon including bezier control points
75 
76 			For detailed discussion, see B2DPolygon::getB2DRange()
77 
78 			@param rCandidate
79 			The B2DPolygon eventually containing bezier segments
80 
81 			@return
82 			The outer range of the bezier curve containing bezier control points
83 		*/
84 		B2DRange getRangeWithControlPoints(const B2DPolygon& rCandidate);
85 
86 		/** Get the range of a polygon
87 
88 			This method creates the outer range of the subdivided bezier curve.
89             For detailed discussion see B2DPolygon::getB2DRange()
90 
91             @param rCandidate
92 			The B2DPolygon eventually containing bezier segments
93 
94 			@return
95 			The outer range of the bezier curve
96 		*/
97 		B2DRange getRange(const B2DPolygon& rCandidate);
98 
99 		// get signed area of polygon
100 		double getSignedArea(const B2DPolygon& rCandidate);
101 
102 		// get area of polygon
103 		double getArea(const B2DPolygon& rCandidate);
104 
105 		/** get length of polygon edge from point nIndex to nIndex + 1 */
106 		double getEdgeLength(const B2DPolygon& rCandidate, sal_uInt32 nIndex);
107 
108 		/** get length of polygon */
109 		double getLength(const B2DPolygon& rCandidate);
110 
111 		// get position on polygon for absolute given distance. If
112 		// length is given, it is assumed the correct polygon length, if 0.0 it is calculated
113 		// using getLength(...)
114 		B2DPoint getPositionAbsolute(const B2DPolygon& rCandidate, double fDistance, double fLength = 0.0);
115 
116 		// get position on polygon for relative given distance in range [0.0 .. 1.0]. If
117 		// length is given, it is assumed the correct polygon length, if 0.0 it is calculated
118 		// using getLength(...)
119 		B2DPoint getPositionRelative(const B2DPolygon& rCandidate, double fDistance, double fLength = 0.0);
120 
121 		// get a snippet from given polygon for absolute distances. The polygon is assumed
122 		// to be opened (not closed). fFrom and fTo need to be in range [0.0 .. fLength], where
123 		// fTo >= fFrom. If length is given, it is assumed the correct polygon length,
124 		// if 0.0 it is calculated using getLength(...)
125 		B2DPolygon getSnippetAbsolute(const B2DPolygon& rCandidate, double fFrom, double fTo, double fLength = 0.0);
126 
127 		// get a snippet from given polygon for relative distances. The polygon is assumed
128 		// to be opened (not closed). fFrom and fTo need to be in range [0.0 .. 1.0], where
129 		// fTo >= fFrom. If length is given, it is assumed the correct polygon length,
130 		// if 0.0 it is calculated using getLength(...)
131 		B2DPolygon getSnippetRelative(const B2DPolygon& rCandidate, double fFrom = 0.0, double fTo = 1.0, double fLength = 0.0);
132 
133 		// Continuity check for point with given index
134 		B2VectorContinuity getContinuityInPoint(const B2DPolygon& rCandidate, sal_uInt32 nIndex);
135 
136 		// Subdivide all contained curves. Use distanceBound value if given.
137 		B2DPolygon adaptiveSubdivideByDistance(const B2DPolygon& rCandidate, double fDistanceBound = 0.0);
138 
139 		// Subdivide all contained curves. Use angleBound value if given.
140 		B2DPolygon adaptiveSubdivideByAngle(const B2DPolygon& rCandidate, double fAngleBound = 0.0);
141 
142 		// #i37443# Subdivide all contained curves.
143 		B2DPolygon adaptiveSubdivideByCount(const B2DPolygon& rCandidate, sal_uInt32 nCount = 0L);
144 
145         // Definitions for the cut flags used from the findCut methods
146 		typedef sal_uInt16 CutFlagValue;
147 
148 		#define	CUTFLAG_NONE			(0x0000)
149 		#define	CUTFLAG_LINE			(0x0001)
150 		#define	CUTFLAG_START1			(0x0002)
151 		#define	CUTFLAG_START2			(0x0004)
152 		#define	CUTFLAG_END1			(0x0008)
153 		#define	CUTFLAG_END2			(0x0010)
154 		#define	CUTFLAG_ALL			(CUTFLAG_LINE|CUTFLAG_START1|CUTFLAG_START2|CUTFLAG_END1|CUTFLAG_END2)
155 		#define	CUTFLAG_DEFAULT		(CUTFLAG_LINE|CUTFLAG_START2|CUTFLAG_END2)
156 
157 		// Calculate cut between the points given by the two indices. pCut1
158 		// and pCut2 will contain the cut coordinate on each edge in ]0.0, 1.0]
159 		// (if given) and the return value will contain a cut description.
160 		CutFlagValue findCut(
161 			const B2DPolygon& rCandidate,
162 			sal_uInt32 nIndex1, sal_uInt32 nIndex2,
163 			CutFlagValue aCutFlags = CUTFLAG_DEFAULT,
164 			double* pCut1 = 0L, double* pCut2 = 0L);
165 
166 		// This version is working with two indexed edges from different
167 		// polygons.
168 		CutFlagValue findCut(
169 			const B2DPolygon& rCandidate1, sal_uInt32 nIndex1,
170 			const B2DPolygon& rCandidate2, sal_uInt32 nIndex2,
171 			CutFlagValue aCutFlags = CUTFLAG_DEFAULT,
172 			double* pCut1 = 0L, double* pCut2 = 0L);
173 
174 		// This version works with two points and vectors to define the
175 		// edges for the cut test.
176 		CutFlagValue findCut(
177 			const B2DPoint& rEdge1Start, const B2DVector& rEdge1Delta,
178 			const B2DPoint& rEdge2Start, const B2DVector& rEdge2Delta,
179 			CutFlagValue aCutFlags = CUTFLAG_DEFAULT,
180 			double* pCut1 = 0L, double* pCut2 = 0L);
181 
182 		// test if point is on the given edge in range ]0.0..1.0[ without
183 		// the start/end points. If so, return true and put the parameter
184 		// value in pCut (if provided)
185 		bool isPointOnEdge(
186 			const B2DPoint& rPoint,
187 			const B2DPoint& rEdgeStart,
188 			const B2DVector& rEdgeDelta,
189 			double* pCut = 0L);
190 
191 		/** Apply given LineDashing to given polygon
192 
193 			This method is used to cut down line polygons to the needed
194 			pieces when a dashing needs to be applied.
195 			It is now capable of keeping contained bezier segments.
196 			It is also capable of delivering line and non-line portions
197 			depending on what target polygons You provide. This is useful
198 			e.g. for dashed lines with two colors.
199 			If the last and the first snippet in one of the results have
200 			a common start/end ppoint, they will be merged to achieve as
201 			view as needed result line snippets. This is also relevant for
202 			further processing the results.
203 
204 			@param rCandidate
205 			The polygon based on which the snippets will be created.
206 
207 			@param rDotDashArray
208 			The line pattern given as array of length values
209 
210 			@param pLineTarget
211 			The target for line snippets, e.g. the first entry will be
212 			a line segment with length rDotDashArray[0]. The given
213 			polygon will be emptied as preparation.
214 
215 			@param pGapTarget
216 			The target for gap snippets, e.g. the first entry will be
217 			a line segment with length rDotDashArray[1]. The given
218 			polygon will be emptied as preparation.
219 
220 			@param fFullDashDotLen
221 			The sumed-up length of the rDotDashArray. If zero, it will
222 			be calculated internally.
223 		*/
224 		void applyLineDashing(
225 			const B2DPolygon& rCandidate,
226 			const ::std::vector<double>& rDotDashArray,
227 			B2DPolyPolygon* pLineTarget,
228             B2DPolyPolygon* pGapTarget = 0,
229 			double fFullDashDotLen = 0.0);
230 
231 		// test if point is inside epsilon-range around an edge defined
232 		// by the two given points. Can be used for HitTesting. The epsilon-range
233 		// is defined to be the rectangle centered to the given edge, using height
234 		// 2 x fDistance, and the circle around both points with radius fDistance.
235 		bool isInEpsilonRange(const B2DPoint& rEdgeStart, const B2DPoint& rEdgeEnd, const B2DPoint& rTestPosition, double fDistance);
236 
237 		// test if point is inside epsilon-range around the given Polygon. Can be used
238 		// for HitTesting. The epsilon-range is defined to be the rectangle centered
239         // to the given edge, using height 2 x fDistance, and the circle around both points
240         // with radius fDistance.
241 		bool isInEpsilonRange(const B2DPolygon& rCandidate, const B2DPoint& rTestPosition, double fDistance);
242 
243         /** Create a polygon from a rectangle.
244 
245 			@param rRect
246             The rectangle which describes the polygon size
247 
248 			@param fRadius
249             Radius of the edge rounding, relative to the rectangle size. 0.0 means no
250 			rounding, 1.0 will lead to an ellipse
251          */
252         B2DPolygon createPolygonFromRect( const B2DRectangle& rRect, double fRadius );
253 
254         /** Create a polygon from a rectangle.
255 
256 			@param rRect
257             The rectangle which describes the polygon size
258 
259 			@param fRadiusX
260 			@param fRadiusY
261             Radius of the edge rounding, relative to the rectangle size. 0.0 means no
262 			rounding, 1.0 will lead to an ellipse
263          */
264 		B2DPolygon createPolygonFromRect( const B2DRectangle& rRect, double fRadiusX, double fRadiusY );
265 
266         /** Create a polygon from a rectangle.
267          */
268 		B2DPolygon createPolygonFromRect( const B2DRectangle& rRect );
269 
270         /** Create the unit polygon
271          */
272 		B2DPolygon createUnitPolygon();
273 
274         /** Create a circle polygon with given radius.
275 
276         	This method creates a circle approximation consisting of
277         	four cubic bezier segments, which approximate the given
278         	circle with an error of less than 0.5 percent.
279 
280         	@param rCenter
281             Center point of the circle
282 
283             @param fRadius
284             Radius of the circle
285          */
286         B2DPolygon createPolygonFromCircle( const B2DPoint& rCenter, double fRadius );
287 
288         /// create half circle centered on (0,0) from [0 .. F_PI]
289         B2DPolygon createHalfUnitCircle();
290 
291 		/** create a polygon which describes the unit circle and close it
292 
293 			@param nStartQuadrant
294 			To be able to rebuild the old behaviour where the circles started at bottom,
295 			this parameter is used. Default is 0 which is the first quadrant and the
296 			polygon's start point will be the rightmost one. When using e.g. 1, the
297 			first created quadrant will start at the YMax-position (with Y down on screens,
298 			this is the lowest one). This is needed since when lines are dashed, toe old
299 			geometry started at bottom point, else it would look different.
300 		 */
301         B2DPolygon createPolygonFromUnitCircle(sal_uInt32 nStartQuadrant = 0);
302 
303 		/** Create an ellipse polygon with given radii.
304 
305         	This method creates an ellipse approximation consisting of
306         	four cubic bezier segments, which approximate the given
307         	ellipse with an error of less than 0.5 percent.
308 
309         	@param rCenter
310             Center point of the circle
311 
312             @param fRadiusX
313             Radius of the ellipse in X direction
314 
315             @param fRadiusY
316             Radius of the ellipse in Y direction
317          */
318         B2DPolygon createPolygonFromEllipse( const B2DPoint& rCenter, double fRadiusX, double fRadiusY );
319 
320 		/** Create an unit ellipse polygon with the given angles, from start to end
321          */
322         B2DPolygon createPolygonFromEllipseSegment( const B2DPoint& rCenter, double fRadiusX, double fRadiusY, double	fStart, double fEnd );
323 
324         B2DPolygon createPolygonFromUnitEllipseSegment( double fStart, double fEnd );
325 
326         /** Predicate whether a given polygon is a rectangle.
327 
328         	@param rPoly
329             Polygon to check
330 
331             @return true, if the polygon describes a rectangle
332             (polygon is closed, and the points are either cw or ccw
333             enumerations of a rectangle's vertices). Note that
334             intermediate points and duplicate points are ignored.
335          */
336         bool isRectangle( const B2DPolygon& rPoly );
337 
338 		// create 3d polygon from given 2d polygon. The given fZCoordinate is used to expand the
339 		// third coordinate.
340 		B3DPolygon createB3DPolygonFromB2DPolygon(const B2DPolygon& rCandidate, double fZCoordinate = 0.0);
341 
342 		// create 2d PolyPolygon from given 3d PolyPolygon. All coordinates are transformed using the given
343 		// matrix and the resulting x,y is used to form the new polygon.
344 		B2DPolygon createB2DPolygonFromB3DPolygon(const B3DPolygon& rCandidate, const B3DHomMatrix& rMat);
345 
346 		// create simplified version of the original polygon by
347 		// replacing segments with spikes/loops and self intersections
348 		// by several trivial sub-segments
349 		B2DPolygon createSimplifiedPolygon(const B2DPolygon&);
350 
351 		// calculate the distance to the given endless ray and return. The relative position on the edge is returned in Cut.
352         // That position may be less than 0.0 or more than 1.0
353 		double getDistancePointToEndlessRay(const B2DPoint& rPointA, const B2DPoint& rPointB, const B2DPoint& rTestPoint, double& rCut);
354 
355 		// calculate the smallest distance to given edge and return. The relative position on the edge is returned in Cut.
356         // That position is in the range [0.0 .. 1.0] and the returned distance is adapted accordingly to the start or end
357         // point of the edge
358 		double getSmallestDistancePointToEdge(const B2DPoint& rPointA, const B2DPoint& rPointB, const B2DPoint& rTestPoint, double& rCut);
359 
360 		// for each contained edge calculate the smallest distance. Return the index to the smallest
361 		// edge in rEdgeIndex. The relative position on the edge is returned in rCut.
362 		// If nothing was found (e.g. empty input plygon), DBL_MAX is returned.
363 		double getSmallestDistancePointToPolygon(const B2DPolygon& rCandidate, const B2DPoint& rTestPoint, sal_uInt32& rEdgeIndex, double& rCut);
364 
365 		// distort single point. rOriginal describes the original range, where the given points describe the distorted corresponding points.
366 		B2DPoint distort(const B2DPoint& rCandidate, const B2DRange& rOriginal, const B2DPoint& rTopLeft, const B2DPoint& rTopRight, const B2DPoint& rBottomLeft, const B2DPoint& rBottomRight);
367 
368 		// distort polygon. rOriginal describes the original range, where the given points describe the distorted corresponding points.
369 		B2DPolygon distort(const B2DPolygon& rCandidate, const B2DRange& rOriginal, const B2DPoint& rTopLeft, const B2DPoint& rTopRight, const B2DPoint& rBottomLeft, const B2DPoint& rBottomRight);
370 
371 		// rotate polygon around given point with given angle.
372 		B2DPolygon rotateAroundPoint(const B2DPolygon& rCandidate, const B2DPoint& rCenter, double fAngle);
373 
374 		// expand all segments (which are not yet) to curve segments. This is done with setting the control
375 		// vectors on the 1/3 resp. 2/3 distances on each segment.
376 		B2DPolygon expandToCurve(const B2DPolygon& rCandidate);
377 
378 		// expand given segment to curve segment. This is done with setting the control
379 		// vectors on the 1/3 resp. 2/3 distances. The return value describes if a change took place.
380 		bool expandToCurveInPoint(B2DPolygon& rCandidate, sal_uInt32 nIndex);
381 
382 		// set continuity for the whole curve. If not a curve, nothing will change. Non-curve points are not changed, too.
383 		B2DPolygon setContinuity(const B2DPolygon& rCandidate, B2VectorContinuity eContinuity);
384 
385 		// set continuity for given index. If not a curve, nothing will change. Non-curve points are not changed, too.
386 		// The return value describes if a change took place.
387 		bool setContinuityInPoint(B2DPolygon& rCandidate, sal_uInt32 nIndex, B2VectorContinuity eContinuity);
388 
389 		// test if polygon contains neutral points. A neutral point is one whos orientation is neutral
390 		// e.g. positioned on the edge of it's predecessor and successor
391 		bool hasNeutralPoints(const B2DPolygon& rCandidate);
392 
393 		// remove neutral points. A neutral point is one whos orientation is neutral
394 		// e.g. positioned on the edge of it's predecessor and successor
395 		B2DPolygon removeNeutralPoints(const B2DPolygon& rCandidate);
396 
397 		// tests if polygon is convex
398 		bool isConvex(const B2DPolygon& rCandidate);
399 
400 		// calculates the orientation at edge nIndex
401 		B2VectorOrientation getOrientationForIndex(const B2DPolygon& rCandidate, sal_uInt32 nIndex);
402 
403 		// calculates if given point is on given line, taking care of the numerical epsilon
404 		bool isPointOnLine(const B2DPoint& rStart, const B2DPoint& rEnd, const B2DPoint& rCandidate, bool bWithPoints = false);
405 
406 		// calculates if given point is on given polygon, taking care of the numerical epsilon. Uses
407 		// isPointOnLine internally
408 		bool isPointOnPolygon(const B2DPolygon& rCandidate, const B2DPoint& rPoint, bool bWithPoints = true);
409 
410 		// test if candidate is inside triangle
411 		bool isPointInTriangle(const B2DPoint& rA, const B2DPoint& rB, const B2DPoint& rC, const B2DPoint& rCandidate, bool bWithBorder = false);
412 
413 		// test if candidateA and candidateB are on the same side of the given line
414 		bool arePointsOnSameSideOfLine(const B2DPoint& rStart, const B2DPoint& rEnd, const B2DPoint& rCandidateA, const B2DPoint& rCandidateB, bool bWithLine = false);
415 
416 		// add triangles for given rCandidate to rTarget. For each triangle, 3 points will be added to rCandidate.
417 		// All triangles will go from the start point of rCandidate to two consecutive points, building (rCandidate.count() - 2)
418 		// triangles.
419 		void addTriangleFan(const B2DPolygon& rCandidate, B2DPolygon& rTarget);
420 
421 		// grow for polygon. Move all geometry in each point in the direction of the normal in that point
422 		// with the given amount. Value may be negative.
423 		B2DPolygon growInNormalDirection(const B2DPolygon& rCandidate, double fValue);
424 
425 		// force all sub-polygons to a point count of nSegments
426 		B2DPolygon reSegmentPolygon(const B2DPolygon& rCandidate, sal_uInt32 nSegments);
427 
428 		// create polygon state at t from 0.0 to 1.0 between the two polygons. Both polygons must have the same
429 		// organisation, e.g. same amount of points
430 		B2DPolygon interpolate(const B2DPolygon& rOld1, const B2DPolygon& rOld2, double t);
431 
432 		bool isPolyPolygonEqualRectangle( const B2DPolyPolygon& rPolyPoly, const B2DRange& rRect );
433 
434 		// #i76891# Try to remove existing curve segments if they are simply edges
435 		B2DPolygon simplifyCurveSegments(const B2DPolygon& rCandidate);
436 
437 		// makes the given indexed point the new polygon start point. To do that, the points in the
438 		// polygon will be rotated. This is only valid for closed polygons, for non-closed ones
439 		// an assertion will be triggered
440 		B2DPolygon makeStartPoint(const B2DPolygon& rCandidate, sal_uInt32 nIndexOfNewStatPoint);
441 
442         /** create edges of given length along given B2DPolygon
443 
444         	@param rCandidate
445             The polygon to move along. Points at the given polygon are created, starting
446 			at position fStart and stopping at less or equal to fEnd. The closed state is
447 			preserved.
448 			The polygon is subdivided if curve segments are included. That subdivision is the base
449 			for the newly created points.
450 			If the source is closed, the indirectly existing last edge may NOT have the
451 			given length.
452 			If the source is open, all edges will have the given length. You may use the last
453 			point of the original when You want to add the last edge Yourself.
454 
455             @param fLength
456             The length of the created edges. If less or equal zero, an empty polygon is returned.
457 
458             @param fStart
459             The start distance for the first to be generated point. Use 0.0 to get the
460 			original start point. Negative values are truncated to 0.0.
461 
462             @param fEnd
463             The maximum distance for the last point. No more points behind this distance will be created.
464 			Use 0.0 to proccess the whole polygon. Negative values are truncated to 0.0. It also
465 			needs to be more or equal to fStart, else it is truncated to fStart.
466 
467 			@return
468 			The newly created polygon
469          */
470 		B2DPolygon createEdgesOfGivenLength(const B2DPolygon& rCandidate, double fLength, double fStart = 0.0, double fEnd = 0.0);
471 
472 		/** Create Waveline along given polygon
473             The implementation is based on createEdgesOfGivenLength and creates a curve
474             segment with the given dimensions for each created line segment. The polygon
475             is treated as if opened (closed state will be ignored) and only for whole
476             edges a curve segment will be created (no rest handling)
477 
478             @param rCandidate
479             The polygon along which the waveline will be created
480 
481             @param fWaveWidth
482             The length of a single waveline curve segment
483 
484             @param fgWaveHeight
485             The height of the waveline (amplitude)
486         */
487 		B2DPolygon createWaveline(const B2DPolygon& rCandidate, double fWaveWidth, double fWaveHeight);
488 
489         /** split each edge of a polygon in exactly nSubEdges equidistant edges
490 
491             @param rCandidate
492             The source polygon. If too small (no edges), nSubEdges too small (<2)
493             or neither bHandleCurvedEdgesnor bHandleStraightEdges it will just be returned.
494             Else for each edge nSubEdges will be created. Closed state is preserved.
495 
496             @param nSubEdges
497             How many edges shall be created as replacement for each single edge
498 
499             @param bHandleCurvedEdges
500             Process curved edges or not. If to handle the curved edges will be splitted
501             into nSubEdges part curved edges of equidistant bezier distances. If not,
502             curved edges will just be copied.
503 
504             @param bHandleStraightEdges
505             Process straight edges or not. If to handle the straight edges will be splitted
506             into nSubEdges part curved edges of equidistant length. If not,
507             straight edges will just be copied.
508         */
509 		B2DPolygon reSegmentPolygonEdges(const B2DPolygon& rCandidate, sal_uInt32 nSubEdges, bool bHandleCurvedEdges, bool bHandleStraightEdges);
510 
511 		//////////////////////////////////////////////////////////////////////
512 		// comparators with tolerance for 2D Polygons
513 		bool equal(const B2DPolygon& rCandidateA, const B2DPolygon& rCandidateB, const double& rfSmallValue);
514 		bool equal(const B2DPolygon& rCandidateA, const B2DPolygon& rCandidateB);
515 
516 		/** snap some polygon coordinates to discrete coordinates
517 
518 			This method allows to snap some polygon points to discrete (integer) values
519 			which equals e.g. a snap to discrete coordinates. It will snap points of
520 			horizontal and vertical edges
521 
522 			@param rCandidate
523 			The source polygon
524 
525 			@return
526 			The modified version of the source polygon
527 		*/
528 		B2DPolygon snapPointsOfHorizontalOrVerticalEdges(const B2DPolygon& rCandidate);
529 
530         /** returns true if the Polygon only contains horizontal or vertical edges
531             so that it could be represented by RegionBands
532         */
533         bool containsOnlyHorizontalAndVerticalEdges(const B2DPolygon& rCandidate);
534 
535         /// get the tangent with which the given point is entered seen from the previous
536         /// polygon path data. Take into account all stuff like closed state, zero-length edges and others.
537         B2DVector getTangentEnteringPoint(const B2DPolygon& rCandidate, sal_uInt32 nIndex);
538 
539         /// get the tangent with which the given point is left seen from the following
540         /// polygon path data. Take into account all stuff like closed state, zero-length edges and others.
541         B2DVector getTangentLeavingPoint(const B2DPolygon& rCandidate, sal_uInt32 nIndex);
542 
543     } // end of namespace tools
544 } // end of namespace basegfx
545 
546 #endif /* _BGFX_POLYGON_B2DPOLYGONTOOLS_HXX */
547