wfmath  1.0.3
A math library for the Worldforge system.
polygon_intersect.h
1 // polygon_funcs.h (Polygon<> intersection functions)
2 //
3 // The WorldForge Project
4 // Copyright (C) 2002 The WorldForge Project
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 //
20 // For information about WorldForge and its authors, please contact
21 // the Worldforge Web Site at http://www.worldforge.org.
22 //
23 
24 // Author: Ron Steinke
25 // Created: 2002-2-20
26 
27 #ifndef WFMATH_POLYGON_INTERSECT_H
28 #define WFMATH_POLYGON_INTERSECT_H
29 
30 #include <wfmath/axisbox.h>
31 #include <wfmath/ball.h>
32 #include <wfmath/polygon.h>
33 #include <wfmath/intersect.h>
34 #include <wfmath/error.h>
35 
36 #include <cmath>
37 
38 #include <cassert>
39 
40 // FIXME Work is needed on this code. At very least the following notes
41 // from the original author apply:
42 // "The Intersect() and Contains() functions involving WFMath::Polygon<>"
43 // "are still under development, and probably shouldn't be used yet."
44 
45 namespace WFMath {
46 
47 
48 template<>
49 bool Intersect(const Polygon<2>& r, const Point<2>& p, bool proper);
50 template<>
51 bool Contains(const Point<2>& p, const Polygon<2>& r, bool proper);
52 
53 template<>
54 bool Intersect(const Polygon<2>& p, const AxisBox<2>& b, bool proper);
55 template<>
56 bool Contains(const Polygon<2>& p, const AxisBox<2>& b, bool proper);
57 template<>
58 bool Contains(const AxisBox<2>& b, const Polygon<2>& p, bool proper);
59 
60 template<>
61 bool Intersect(const Polygon<2>& p, const Ball<2>& b, bool proper);
62 template<>
63 bool Contains(const Polygon<2>& p, const Ball<2>& b, bool proper);
64 template<>
65 bool Contains(const Ball<2>& b, const Polygon<2>& p, bool proper);
66 
67 template<>
68 bool Intersect(const Polygon<2>& p, const Segment<2>& s, bool proper);
69 template<>
70 bool Contains(const Polygon<2>& p, const Segment<2>& s, bool proper);
71 template<>
72 bool Contains(const Segment<2>& s, const Polygon<2>& p, bool proper);
73 
74 template<>
75 bool Intersect(const Polygon<2>& p, const RotBox<2>& r, bool proper);
76 template<>
77 bool Contains(const Polygon<2>& p, const RotBox<2>& r, bool proper);
78 template<>
79 bool Contains(const RotBox<2>& r, const Polygon<2>& p, bool proper);
80 
81 template<>
82 bool Intersect(const Polygon<2>& p1, const Polygon<2>& p2, bool proper);
83 template<>
84 bool Contains(const Polygon<2>& outer, const Polygon<2>& inner, bool proper);
85 
86 } // namespace WFMath
87 
88 #endif // WFMATH_POLYGON_INTERSECT_H
Generic library namespace.
Definition: shape.h:41