00001
00011 #ifndef _H_SPATIAL_TREE
00012 #define _H_SPATIAL_TREE
00013
00014 #include "Tree.h"
00015 #include "Polytope.h"
00016 #include "Point.h"
00017 #include "Bounding_Box.h"
00018 #include "Cubic_Bounding_Box_Container.h"
00019 #include "BBGenerator.h"
00020
00030 template < typename tree_type, typename bb_type, typename container_type >
00031 class Spatial_Tree : public Tree< container_type*, tree_type > {
00032 private:
00033
00034 public:
00035
00041 virtual bool checkReady() const { return true; }
00042
00047 virtual void ensureReady() {}
00048
00052 virtual ~Spatial_Tree() {}
00053
00060
00061
00068 virtual tree_type *insert( container_type *container ) = 0;
00069
00080
00081
00091 virtual tree_type *remove( container_type *container ) = 0;
00092
00099 template < class InputIterator >
00100 void insertPolytopes( InputIterator begin, InputIterator end ) { for ( ; begin!=end; ++begin ) insert( extractCubicBoundingBox( *begin ) ); }
00101
00109 virtual vector<int> neighboursOf( const container_type *item ) const = 0;
00110
00119 virtual vector<int> neighboursOf( const vector<double> &point, const unsigned int k ) const = 0;
00120
00121
00128 virtual vector<int> containedIn( const bb_type &box ) const = 0;
00129
00136 virtual vector<int> intersects( const Point &point ) const = 0;
00137
00147 virtual vector<int> intersects( const vector<double> &begin, const vector<double> &end ) const = 0;
00148
00164 virtual vector<int> intersects( const vector<double> &a, const double b ) const = 0;
00165
00166 #ifdef _NODE_COUNT
00167
00173 virtual int visitedNodes() const = 0;
00174 #endif
00175
00176 };
00177
00178 #endif