00001
00010 #ifndef _H_BOUNDING_BOX
00011 #define _H_BOUNDING_BOX
00012
00013 #include "Point.h"
00014 #include "Polytope.h"
00015 #include "orderings.h"
00016
00017 #include <vector>
00018
00024 template < typename bb_type >
00025 class Bounding_Box {
00026 private:
00027
00028 protected:
00029
00030 public:
00031
00040 static Ordering< bb_type > * getDefaultOrdering() { cerr << "No default ordering defined on abstract Bounding Box" << endl; exit( 1 ); }
00041
00050 static vector< Ordering< bb_type > * > getOrderings() { cerr << "No orderings defined on abstract Bounding Box" << endl; exit( 1 ); };
00051
00053 virtual ~Bounding_Box() {}
00054
00059 virtual unsigned int getDimension() const = 0;
00060
00067 virtual void become( const bb_type *bb ) = 0;
00068
00078 virtual bool lineIntersect( const vector< double > &start, const vector< double > &end ) const = 0;
00079
00086 virtual bool intersects( const bb_type &x ) const = 0;
00087
00094 virtual bool contains( const Point &x ) const = 0;
00095
00103 virtual bool contains( const bb_type &other ) const = 0;
00104
00111 virtual bb_type unionWith( const bb_type &other ) const = 0;
00112
00121 virtual void unite( const bb_type *other ) = 0;
00122
00129 virtual bb_type intersect( const bb_type &other ) const = 0;
00130
00136 virtual bool isEmpty() const = 0;
00137
00143 virtual string toString() const = 0;
00144
00148 virtual void clear() = 0;
00149
00156 virtual void writeToFile( ofstream &ofs ) const = 0;
00157
00163 virtual void getCenterCoordinate( vector< double > * into ) const = 0;
00164
00176 virtual bool isDefining( bb_type * other ) const = 0;
00177
00179 Bounding_Box() { }
00180
00186 Bounding_Box( bb_type * bb ) { }
00187 };
00188
00189
00190
00191
00192
00193
00194
00195 #endif