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