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_CUTANDTOUCH_HXX
25 #define _BGFX_POLYGON_CUTANDTOUCH_HXX
26 
27 #include <basegfx/polygon/b2dpolygon.hxx>
28 #include <basegfx/polygon/b2dpolypolygon.hxx>
29 
30 //////////////////////////////////////////////////////////////////////////////
31 
32 namespace basegfx
33 {
34 	namespace tools
35 	{
36 		// look for self-intersections and self-touches (points on an edge) in given polygon and add
37 		// extra points there. Result will have no touches or intersections on an edge, only on points
38 		B2DPolygon addPointsAtCutsAndTouches(const B2DPolygon& rCandidate);
39 
40 		// look for polypolygon-intersections and polypolygon-touches (point of poly A on an edge of poly B) in given PolyPolygon and add
41 		// extra points there. Result will have no touches or intersections between contained polygons on an edge, only on points. For
42 		// convenience, the correction for self-intersections for each member polygon will be used, too.
43 		// Changed: Self intersections are searched by default, but may be switched off by 2nd parameter.
44 		B2DPolyPolygon addPointsAtCutsAndTouches(const B2DPolyPolygon& rCandidate, bool bSelfIntersections = true);
45 
46 		// look for intersections of rCandidate with all polygons from rMask and add extra points there. Do
47 		// not change or add points to rMask.
48 		B2DPolygon addPointsAtCutsAndTouches(const B2DPolyPolygon& rMask, const B2DPolygon& rCandidate);
49 
50 		// look for intersections of rCandidate with all polygons from rMask and add extra points there. Do
51 		// not change or add points to rMask.
52 		B2DPolyPolygon addPointsAtCutsAndTouches(const B2DPolyPolygon& rMask, const B2DPolyPolygon& rCandidate);
53 
54 		// look for intersections of rCandidate with the edge from rStart to rEnd and add extra points there.
55         // Points are only added in the range of the edge, not on the endless vector.
56         B2DPolygon addPointsAtCuts(const B2DPolygon& rCandidate, const B2DPoint& rStart, const B2DPoint& rEnd);
57         B2DPolyPolygon addPointsAtCuts(const B2DPolyPolygon& rCandidate, const B2DPoint& rStart, const B2DPoint& rEnd);
58 
59 		// look for intersections of rCandidate with the mask Polygon and add extra points there.
60         // The mask polygon is assumed to be closed, even when it's not explicitely.
61         B2DPolygon addPointsAtCuts(const B2DPolygon& rCandidate, const B2DPolyPolygon& rMask);
62         B2DPolyPolygon addPointsAtCuts(const B2DPolyPolygon& rCandidate, const B2DPolyPolygon& rMask);
63 
64 		// look for self-intersections in given polygon and add extra points there. Result will have no
65         // intersections on an edge
66 		B2DPolygon addPointsAtCuts(const B2DPolygon& rCandidate);
67 
68         // add points at all self-intersections of single polygons (depends on bSelfIntersections)
69         // and at polygon-polygon intersections
70 		B2DPolyPolygon addPointsAtCuts(const B2DPolyPolygon& rCandidate, bool bSelfIntersections = true);
71 
72     } // end of namespace tools
73 } // end of namespace basegfx
74 
75 //////////////////////////////////////////////////////////////////////////////
76 
77 #endif /* _BGFX_POLYGON_CUTANDTOUCH_HXX */
78