vtf-logo

BBox.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00008 #if !defined(__geom_BBox_h__)
00009 #define __geom_BBox_h__
00010 
00011 // If we are debugging the whole geom package.
00012 #if defined(DEBUG_geom) && !defined(DEBUG_BBox)
00013 #define DEBUG_BBox
00014 #endif
00015 
00016 #ifdef DEBUG_BBox
00017 // Debug the Interval class as well.
00018 #ifndef DEBUG_Interval
00019 #define DEBUG_Interval
00020 #endif
00021 #endif
00022 
00023 #include "SemiOpenInterval.h"
00024 
00025 #include <vector>
00026 
00027 #include <cmath>
00028   
00029 BEGIN_NAMESPACE_GEOM
00030 
00032 
00036 template<int N, typename T = double>
00037 class BBox
00038   : public Interval<N,T> {
00039 private:
00040 
00041   //
00042   // Private types
00043   //
00044 
00045   typedef Interval<N,T> Base;
00046 
00047 public:
00048 
00049   //
00050   // Public types
00051   //
00052 
00054   typedef T Number;
00056   typedef typename Base::Point Point;
00057 
00058 public:
00059   
00060   //--------------------------------------------------------------------------
00062   // @{
00063   
00065   BBox() : 
00066     Base() 
00067   {}
00068 
00070   BBox(const Point& min, const Point& max) :
00071     Base(min, max)
00072   {}
00073     
00075   BBox(const Number xmin, const Number xmax) :
00076     Base(xmin, xmax)
00077   {}
00078     
00080   BBox(const Number xmin, const Number ymin, 
00081        const Number xmax, const Number ymax) :
00082     Base(xmin, ymin, xmax, ymax)
00083   {}
00084     
00086   BBox(const Number xmin, const Number ymin, const Number zmin,
00087        const Number xmax, const Number ymax, const Number zmax) :
00088     Base(xmin, ymin, zmin, xmax, ymax, zmax)
00089   {}
00090     
00092 
00095   BBox(const Number* coordinates) :
00096     Base(coordinates)
00097   {}
00098     
00100   BBox(const BBox& other) :
00101     Base(other)
00102   {}
00103 
00105   BBox(const Interval<N,T>& x) :
00106     Base(x)
00107   {}
00108 
00110   BBox& 
00111   operator=(const BBox& other) {
00112     Base::operator=(other);
00113     return *this;
00114   }
00115 
00117   ~BBox() 
00118   {}
00119 
00120   // @}
00121   //--------------------------------------------------------------------------
00125   // @{
00126 
00128   using Base::add;
00129 
00131   using Base::bound;
00132 
00133   // @}
00134   //--------------------------------------------------------------------------
00138   // @{
00139     
00141   using Base::getLowerCorner;
00142 
00144   using Base::getUpperCorner;
00145 
00147   using Base::computeContent;
00148 
00149   // @}
00150   //--------------------------------------------------------------------------
00154   // @{
00155 
00157   using Base::setCorners;
00158 
00160   using Base::setLowerCorner;
00161 
00163   using Base::setUpperCorner;
00164 
00166   using Base::setLowerCoordinate;
00167 
00169   using Base::setUpperCoordinate;
00170 
00171   // @}
00172   //--------------------------------------------------------------------------
00174   // @{
00175 
00177   using Base::getDimension;
00178 
00179   // @}
00180   //--------------------------------------------------------------------------
00182   // @{
00183 
00185   bool 
00186   isEmpty() const;
00187 
00189   template<typename PointType>
00190   bool 
00191   isIn(const PointType& p) const;
00192 
00194   bool 
00195   isIn(const BBox& x) const;
00196 
00198   bool 
00199   isIn(const SemiOpenInterval<N,T>& x) const;
00200 
00201   // @}
00202 };
00203 
00204 
00205 //
00206 // File I/O.
00207 //
00208 
00209   
00211 
00212 template<int N, typename T>
00213 void
00214 printFormatted(std::ostream& out, const BBox<N,T>& x);
00215 
00216 
00217 //
00218 // Mathematical Functions.
00219 //
00220 
00221  
00223 
00224 template<int N, typename T>
00225 bool 
00226 doOverlap(const BBox<N,T>& a, const BBox<N,T>& b);
00227 
00228 
00230 
00231 template<int N, typename T>
00232 bool 
00233 doOverlap(const BBox<N,T>& a, const SemiOpenInterval<N,T>& b);
00234 
00235 
00237 
00246 template<typename MultiIndexOutputIterator, typename T>
00247 void
00248 scanConvert(MultiIndexOutputIterator indices, const BBox<3,T>& box);
00249 
00250 
00252 
00259 template<typename MultiIndexOutputIterator>
00260 void
00261 scanConvert(MultiIndexOutputIterator indices, const BBox<3,int>& box);
00262 
00263 
00265 
00276 template<typename MultiIndexOutputIterator, typename T>
00277 void
00278 scanConvert(MultiIndexOutputIterator indices, const BBox<3,T>& box,
00279             const BBox<3,int>& domain);
00280 
00281 
00283 
00292 template<typename MultiIndexOutputIterator>
00293 void
00294 scanConvert(MultiIndexOutputIterator indices, const BBox<3,int>& box,
00295             const BBox<3,int>& domain);
00296 
00297 
00298 // CONTINUE: get rid of this
00299 #if 0
00301 
00302 template<typename T, typename _IndexType>
00303 int 
00304 scanConvert(std::vector<_IndexType>& indexSet, const BBox<3,T>& box);
00305 #endif
00306 
00307 
00308 // CONTINUE: get rid of this
00309 #if 0
00311 
00312 template<typename T, typename _IndexType>
00313 int 
00314 scanConvert(std::vector<_IndexType>& indexSet,
00315             const BBox<3,T>& box, const BBox<3,T>& domain);
00316 #endif
00317 
00318 
00319 END_NAMESPACE_GEOM
00320 
00321 #define __geom_BBox_ipp__
00322 #include "BBox.ipp"
00323 #undef __geom_BBox_ipp__
00324 
00325 #endif

Generated on Fri Aug 24 12:55:51 2007 for Computational Geometry Package by  doxygen 1.4.7