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_POLYPOLYGON_B3DPOLYGONCLIPPER_HXX
25 #define _BGFX_POLYPOLYGON_B3DPOLYGONCLIPPER_HXX
26 
27 #include <basegfx/polygon/b3dpolypolygon.hxx>
28 #include <basegfx/polygon/b3dpolygon.hxx>
29 
30 //////////////////////////////////////////////////////////////////////////////
31 
32 namespace basegfx
33 {
34 	// predefinitions
35 	class B3DRange;
36 	class B2DRange;
37 
38 	namespace tools
39 	{
40 		/**	define for deciding one of X,Y,Z directions
41 		*/
42 		enum B3DOrientation
43 		{
44 			B3DORIENTATION_X,		// X-Axis
45 			B3DORIENTATION_Y,		// Y-Axis
46 			B3DORIENTATION_Z		// Z-Axis
47 		};
48 
49 		// Clip given 3D polygon against a plane orthogonal to X,Y or Z axis. The plane is defined using the
50 		// enum ePlaneOrthogonal which names the vector orthogonal to the plane, the fPlaneOffset gives the distance
51 		// of the plane from the center (0.0).
52 		// The value bClipPositive defines on which side the return value will be (true -> on positive side of plane).
53 		// The switch bStroke decides if the polygon is interpreted as area (false) or strokes (true).
54 		B3DPolyPolygon clipPolyPolygonOnOrthogonalPlane(const B3DPolyPolygon& rCandidate, B3DOrientation ePlaneOrthogonal, bool bClipPositive, double fPlaneOffset, bool bStroke);
55 
56 		// version for Polygons
57 		B3DPolyPolygon clipPolygonOnOrthogonalPlane(const B3DPolygon& rCandidate, B3DOrientation ePlaneOrthogonal, bool bClipPositive, double fPlaneOffset, bool bStroke);
58 
59 		// Clip the given PolyPolygon against the given range. bInside defines if the result will contain the
60 		// parts which are contained in the range or vice versa.
61 		// The switch bStroke decides if the polygon is interpreted as area (false) or strokes (true).
62 		B3DPolyPolygon clipPolyPolygonOnRange(const B3DPolyPolygon& rCandidate, const B3DRange& rRange, bool bInside, bool bStroke);
63 
64 		// version for Polygons
65 		B3DPolyPolygon clipPolygonOnRange(const B3DPolygon& rCandidate, const B3DRange& rRange, bool bInside, bool bStroke);
66 
67 		// versions for B2DRange, clips only against X,Y
68 		B3DPolyPolygon clipPolyPolygonOnRange(const B3DPolyPolygon& rCandidate, const B2DRange& rRange, bool bInside, bool bStroke);
69 		B3DPolyPolygon clipPolygonOnRange(const B3DPolygon& rCandidate, const B2DRange& rRange, bool bInside, bool bStroke);
70 
71 		// Clip the given PolyPolygon against given plane in 3D. The plane is defined by a plane normal and a point on the plane.
72 		// The value bClipPositive defines on which side the return value will be (true -> on positive side of plane).
73 		// The switch bStroke decides if the polygon is interpreted as area (false) or strokes (true).
74 		B3DPolyPolygon clipPolyPolygonOnPlane(const B3DPolyPolygon& rCandidate, const B3DPoint& rPointOnPlane, const B3DVector& rPlaneNormal, bool bClipPositive, bool bStroke);
75 
76 		// version for Polygons
77 		B3DPolyPolygon clipPolygonOnPlane(const B3DPolygon& rCandidate, const B3DPoint& rPointOnPlane, const B3DVector& rPlaneNormal, bool bClipPositive, bool bStroke);
78 
79 	} // end of namespace tools
80 } // end of namespace basegfx
81 
82 #endif /* _BGFX_POLYPOLYGON_B3DPOLYGONCLIPPER_HXX */
83