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