00001 #ifndef AFL_UTIL_GEOM_H
00002 #define AFL_UTIL_GEOM_H
00003
00004 #include "../afltypes.h"
00005 #include "../element.h"
00006 #include "../simplex.h"
00007 #include "../ddf/ddf.h"
00008 #include "../exc/aflexc.h"
00009
00010 #include <string>
00011
00012 namespace afl
00013 {
00014 namespace util
00015 {
00016 namespace geom
00017 {
00030 Point intersect_2(const Point& a, const Point& b, const Point& c, const Point& d, bool segment = false ) throw(exc::GeometryException);
00031
00044 Point intersect_3(const Point& a, const Point& b, const Point& c, const Point& d, bool segment = false ) throw(exc::GeometryException);
00045
00058 Point intersect_4(const Point& a, const Point& b, const Point& c, const Point& d, bool segment = false ) throw(exc::GeometryException);
00059
00066 data_t volume_2( const Point& a, const Point& b, const Point& c );
00067
00075 data_t volume_3( const Point& a, const Point& b, const Point& c, const Point& d );
00076
00085 data_t volume_4( const Point& a, const Point& b, const Point& c, const Point& d, const Point& e );
00086
00092 bool isInside_1( const Simplex& s, const Point& p );
00093
00101 bool isInside( const Element<2>& e, const ddf::Property* xs, const Point& p );
00102
00108 bool isInside_2( const Simplex& s, const Point& p );
00109
00117 bool isInside( const Element<3>& e, const ddf::Property* xs, const Point& p );
00118
00124 bool isInside_3( const Simplex& s, const Point& p );
00125
00133 bool isInside( const Element<4>& e, const ddf::Property* xs, const Point& p );
00134
00140 bool isInside_4( const Simplex& s, const Point& p );
00141
00150 template <size_t D>
00151 bool isInside( const Element<D>& e, const ddf::Property* xs, const Point& p )
00152 {
00153 std::ostringstream oss;
00154 oss << "error: used an incorrect version of isInside: " << D << "D" << std::endl;
00155 throw exc::Exception(oss.str());
00156 }
00157
00164 data_t distance( const Point& p1, const Point& p2 );
00165
00178 Point closest_2( const Point& a, const Point& b, const Point& c, bool segment = false );
00179 }
00180 }
00181 }
00182
00183 #endif
00184