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
45namespace WFMath {
46
47
48template<>
49bool Intersect(const Polygon<2>& r, const Point<2>& p, bool proper);
50template<>
51bool Contains(const Point<2>& p, const Polygon<2>& r, bool proper);
52
53template<>
54bool Intersect(const Polygon<2>& p, const AxisBox<2>& b, bool proper);
55template<>
56bool Contains(const Polygon<2>& p, const AxisBox<2>& b, bool proper);
57template<>
58bool Contains(const AxisBox<2>& b, const Polygon<2>& p, bool proper);
59
60template<>
61bool Intersect(const Polygon<2>& p, const Ball<2>& b, bool proper);
62template<>
63bool Contains(const Polygon<2>& p, const Ball<2>& b, bool proper);
64template<>
65bool Contains(const Ball<2>& b, const Polygon<2>& p, bool proper);
66
67template<>
68bool Intersect(const Polygon<2>& p, const Segment<2>& s, bool proper);
69template<>
70bool Contains(const Polygon<2>& p, const Segment<2>& s, bool proper);
71template<>
72bool Contains(const Segment<2>& s, const Polygon<2>& p, bool proper);
73
74template<>
75bool Intersect(const Polygon<2>& p, const RotBox<2>& r, bool proper);
76template<>
77bool Contains(const Polygon<2>& p, const RotBox<2>& r, bool proper);
78template<>
79bool Contains(const RotBox<2>& r, const Polygon<2>& p, bool proper);
80
81template<>
82bool Intersect(const Polygon<2>& p1, const Polygon<2>& p2, bool proper);
83template<>
84bool 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