WFMath
0.3.12
|
00001 // intersect_decls.h (Declarations for "friend" intersection functions) 00002 // 00003 // The WorldForge Project 00004 // Copyright (C) 2002 The WorldForge Project 00005 // 00006 // This program is free software; you can redistribute it and/or modify 00007 // it under the terms of the GNU General Public License as published by 00008 // the Free Software Foundation; either version 2 of the License, or 00009 // (at your option) any later version. 00010 // 00011 // This program is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 // GNU General Public License for more details. 00015 // 00016 // You should have received a copy of the GNU General Public License 00017 // along with this program; if not, write to the Free Software 00018 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00019 // 00020 // For information about WorldForge and its authors, please contact 00021 // the Worldforge Web Site at http://www.worldforge.org. 00022 // 00023 00024 // Author: Ron Steinke 00025 00026 #ifndef WFMATH_INTERSECT_DECLS_H 00027 #define WFMATH_INTERSECT_DECLS_H 00028 00029 #include <wfmath/const.h> 00030 00031 namespace WFMath { 00032 00033 // Some Intersect and Contains helper functions 00034 00035 inline bool _Less(CoordType x1, CoordType x2, bool proper) 00036 { 00037 return !proper ? x1 < x2 : x1 <= x2; 00038 } 00039 00040 inline bool _LessEq(CoordType x1, CoordType x2, bool proper) 00041 { 00042 return !proper ? x1 <= x2 : x1 < x2; 00043 } 00044 00045 inline bool _Greater(CoordType x1, CoordType x2, bool proper) 00046 { 00047 return !proper ? x1 > x2 : x1 >= x2; 00048 } 00049 00050 inline bool _GreaterEq(CoordType x1, CoordType x2, bool proper) 00051 { 00052 return !proper ? x1 >= x2 : x1 > x2; 00053 } 00054 00055 template<int dim> 00056 bool Intersect(const AxisBox<dim>& b, const Point<dim>& p, bool proper); 00057 template<int dim> 00058 bool Contains(const Point<dim>& p, const AxisBox<dim>& b, bool proper); 00059 00060 template<int dim> 00061 bool Intersect(const Ball<dim>& b, const Point<dim>& p, bool proper); 00062 template<int dim> 00063 bool Contains(const Point<dim>& p, const Ball<dim>& b, bool proper); 00064 00065 template<int dim> 00066 bool Intersect(const Segment<dim>& s, const Point<dim>& p, bool proper); 00067 template<int dim> 00068 bool Contains(const Point<dim>& p, const Segment<dim>& s, bool proper); 00069 00070 template<int dim> 00071 bool Intersect(const RotBox<dim>& r, const Point<dim>& p, bool proper); 00072 template<int dim> 00073 bool Contains(const Point<dim>& p, const RotBox<dim>& r, bool proper); 00074 00075 template<int dim> 00076 bool Intersect(const AxisBox<dim>& b1, const AxisBox<dim>& b2, bool proper); 00077 template<int dim> 00078 bool Contains(const AxisBox<dim>& outer, const AxisBox<dim>& inner, bool proper); 00079 00080 template<int dim> 00081 bool Intersect(const Ball<dim>& b, const AxisBox<dim>& a, bool proper); 00082 template<int dim> 00083 bool Contains(const Ball<dim>& b, const AxisBox<dim>& a, bool proper); 00084 template<int dim> 00085 bool Contains(const AxisBox<dim>& a, const Ball<dim>& b, bool proper); 00086 00087 template<int dim> 00088 bool Intersect(const Segment<dim>& s, const AxisBox<dim>& b, bool proper); 00089 template<int dim> 00090 bool Contains(const Segment<dim>& s, const AxisBox<dim>& b, bool proper); 00091 template<int dim> 00092 bool Contains(const AxisBox<dim>& b, const Segment<dim>& s, bool proper); 00093 00094 template<int dim> 00095 bool Intersect(const RotBox<dim>& r, const AxisBox<dim>& b, bool proper); 00096 template<int dim> 00097 bool Contains(const RotBox<dim>& r, const AxisBox<dim>& b, bool proper); 00098 template<int dim> 00099 bool Contains(const AxisBox<dim>& b, const RotBox<dim>& r, bool proper); 00100 00101 template<int dim> 00102 bool Intersect(const Ball<dim>& b1, const Ball<dim>& b2, bool proper); 00103 template<int dim> 00104 bool Contains(const Ball<dim>& outer, const Ball<dim>& inner, bool proper); 00105 00106 template<int dim> 00107 bool Intersect(const Segment<dim>& s, const Ball<dim>& b, bool proper); 00108 template<int dim> 00109 bool Contains(const Ball<dim>& b, const Segment<dim>& s, bool proper); 00110 template<int dim> 00111 bool Contains(const Segment<dim>& s, const Ball<dim>& b, bool proper); 00112 00113 template<int dim> 00114 bool Intersect(const RotBox<dim>& r, const Ball<dim>& b, bool proper); 00115 template<int dim> 00116 bool Contains(const RotBox<dim>& r, const Ball<dim>& b, bool proper); 00117 template<int dim> 00118 bool Contains(const Ball<dim>& b, const RotBox<dim>& r, bool proper); 00119 00120 template<int dim> 00121 bool Intersect(const Segment<dim>& s1, const Segment<dim>& s2, bool proper); 00122 template<int dim> 00123 bool Contains(const Segment<dim>& s1, const Segment<dim>& s2, bool proper); 00124 00125 template<int dim> 00126 bool Intersect(const RotBox<dim>& r, const Segment<dim>& s, bool proper); 00127 template<int dim> 00128 bool Contains(const RotBox<dim>& r, const Segment<dim>& s, bool proper); 00129 template<int dim> 00130 bool Contains(const Segment<dim>& s, const RotBox<dim>& r, bool proper); 00131 00132 template<int dim> 00133 bool Intersect(const RotBox<dim>& r1, const RotBox<dim>& r2, bool proper); 00134 template<int dim> 00135 bool Contains(const RotBox<dim>& outer, const RotBox<dim>& inner, bool proper); 00136 00137 template<int dim> 00138 bool Intersect(const Polygon<dim>& r, const Point<dim>& p, bool proper); 00139 template<int dim> 00140 bool Contains(const Point<dim>& p, const Polygon<dim>& r, bool proper); 00141 00142 template<int dim> 00143 bool Intersect(const Polygon<dim>& p, const AxisBox<dim>& b, bool proper); 00144 template<int dim> 00145 bool Contains(const Polygon<dim>& p, const AxisBox<dim>& b, bool proper); 00146 template<int dim> 00147 bool Contains(const AxisBox<dim>& b, const Polygon<dim>& p, bool proper); 00148 00149 template<int dim> 00150 bool Intersect(const Polygon<dim>& p, const Ball<dim>& b, bool proper); 00151 template<int dim> 00152 bool Contains(const Polygon<dim>& p, const Ball<dim>& b, bool proper); 00153 template<int dim> 00154 bool Contains(const Ball<dim>& b, const Polygon<dim>& p, bool proper); 00155 00156 template<int dim> 00157 bool Intersect(const Polygon<dim>& r, const Segment<dim>& s, bool proper); 00158 template<int dim> 00159 bool Contains(const Polygon<dim>& p, const Segment<dim>& s, bool proper); 00160 template<int dim> 00161 bool Contains(const Segment<dim>& s, const Polygon<dim>& p, bool proper); 00162 00163 template<int dim> 00164 bool Intersect(const Polygon<dim>& p, const RotBox<dim>& r, bool proper); 00165 template<int dim> 00166 bool Contains(const Polygon<dim>& p, const RotBox<dim>& r, bool proper); 00167 template<int dim> 00168 bool Contains(const RotBox<dim>& r, const Polygon<dim>& p, bool proper); 00169 00170 template<int dim> 00171 bool Intersect(const Polygon<dim>& p1, const Polygon<dim>& p2, bool proper); 00172 template<int dim> 00173 bool Contains(const Polygon<dim>& outer, const Polygon<dim>& inner, bool proper); 00174 00175 } // namespace WFMath 00176 00177 #endif // WFMATH_INTERSECT_DECLS_H