Cubic_Bounding_Box_Container.h

Go to the documentation of this file.
00001 /*
00002  *  Copyright (C) 2007  A.N. Yzelman
00003  *  Released under LGPL, see license.txt
00004  *
00005  *  Last modified at 24th of April, 2007, by A.N. Yzelman
00006  *
00007  *  Cubic_Bounding_Box_Container.h: Definition of a Bounding Box with a hypercubic shape,
00008  *                                                                  storing an ID.
00009  */
00010 
00011 #ifndef _H_CUBIC_BOUNDING_BOX_CONTAINER
00012 #define _H_CUBIC_BOUNDING_BOX_CONTAINER
00013 
00014 #include "Cubic_Bounding_Box.h"
00015 
00019 class Cubic_Bounding_Box_Container : public Cubic_Bounding_Box {
00020 
00024         friend class CubicLowCoorOrdering< 0, Cubic_Bounding_Box_Container >;
00025 
00029         friend class CubicLowCoorOrdering< 1, Cubic_Bounding_Box_Container >;
00030 
00034         friend class CubicLowCoorOrdering< 2, Cubic_Bounding_Box_Container >;
00035 
00039         friend class DistOrdering< Cubic_Bounding_Box_Container >;
00040 
00041   protected:
00042   
00044         unsigned int index;
00045 
00046   public:
00047 
00053         unsigned int getID() const { return index; }
00054 
00056         Cubic_Bounding_Box_Container( Cubic_Bounding_Box_Container *cbbc ) {
00057                 _mins = cbbc->_mins; _maxs = cbbc->_maxs; index = cbbc->index;
00058         }
00059 
00067         Cubic_Bounding_Box_Container( vector< double > mins, vector< double > maxs, unsigned int i ) {
00068                 _mins = mins; _maxs = maxs; index = i;
00069         }
00070 
00077         Cubic_Bounding_Box_Container( Polytope p ) {
00078 
00079                 //declare
00080                 int dim = p.getDimension();
00081                 vector<double> mins;
00082                 vector<double> maxs;
00083                 mins.resize(dim);
00084                 maxs.resize(dim);
00085 
00086 #ifdef _DEBUG
00087                 cout << "Number of polytope angles: " << dim << endl;
00088 #endif
00089 
00090                 //find coordinates
00091                 for ( int i=0; i<dim; i++ ) {
00092                         mins[i] = p.getMinCoordinateOnDimension( i );
00093 
00094 #ifdef _DEBUG
00095                         cout << "Polytope min: " << mins[i] << endl;
00096 #endif
00097 
00098                         maxs[i] = p.getMaxCoordinateOnDimension( i );
00099 
00100 #ifdef _DEBUG
00101                         cout << "Polytope max: " << maxs[i] << endl;
00102 #endif
00103                 }
00104 
00105                 //proceed with construction
00106                 _mins = mins; _maxs = maxs; index = p.getIdentification();
00107         }
00108 
00115         Cubic_Bounding_Box_Container( Polytope *p ) {
00116                 //declare
00117                 int dim = p->getDimension();
00118                 vector<double> mins;
00119                 vector<double> maxs;
00120                 mins.resize(dim);
00121                 maxs.resize(dim);
00122 
00123 #ifdef _DEBUG
00124                 cout << "Number of polytope angles: " << dim << endl;
00125 #endif
00126 
00127                 //find coordinates
00128                 for ( int i=0; i<dim; i++ ) {
00129                         mins[i] = p->getMinCoordinateOnDimension( i );
00130 
00131 #ifdef _DEBUG
00132                         cout << "Polytope min: " << mins[i] << endl;
00133 #endif
00134 
00135                         maxs[i] = p->getMaxCoordinateOnDimension( i );
00136 
00137 #ifdef _DEBUG
00138                         cout << "Polytope max: " << maxs[i] << endl;
00139 #endif
00140 
00141                 }
00142 
00143                 //proceed with construction
00144                 _mins = mins; _maxs = maxs; index = p->getIdentification();
00145 
00146         }
00147         
00157         virtual void writeToFile( ofstream &ofs ) const {
00158 
00159                 ofs << index << " ";
00160                 ofs << (_mins[0]) << " " << (_mins[1]) << " " << (_mins[2]) << " ";
00161                 ofs << (_maxs[0]) << " " << (_maxs[1]) << " " << (_maxs[2]) << endl;
00162 
00163         }
00164 
00165 
00170         static Ordering< Cubic_Bounding_Box_Container > * getDefaultOrdering();
00171 
00177         static vector< Ordering< Cubic_Bounding_Box_Container > * > getOrderings();
00178 
00180         static CubicLowCoorOrdering< 0, Cubic_Bounding_Box_Container > LCXC_ORDERING;
00181 
00183         static CubicLowCoorOrdering< 1, Cubic_Bounding_Box_Container > LCYC_ORDERING;
00184 
00186         static CubicLowCoorOrdering< 2, Cubic_Bounding_Box_Container > LCZC_ORDERING;
00187 
00189         static DistOrdering< Cubic_Bounding_Box_Container > DISTC_ORDERING;
00190         
00192         static HilbertOrdering3D< Cubic_Bounding_Box_Container > HILC_ORDERING;
00193         
00195         static CURRENTORDERING< Cubic_Bounding_Box_Container > NO_ORDERING;
00196 
00197 };
00198 
00202 ostream& operator<<( ostream &os, const Cubic_Bounding_Box_Container box );
00203 
00204 #endif
00205 

Generated on Sat Oct 13 17:34:42 2007 for R-Tree by  doxygen 1.5.2