core/vbl/vbl_bounding_box.txx
Go to the documentation of this file.
00001 // This is core/vbl/vbl_bounding_box.txx
00002 #ifndef vbl_bounding_box_txx_
00003 #define vbl_bounding_box_txx_
00004 
00005 //-*- c++ -*-------------------------------------------------------------------
00006 //
00007 
00008 // Author: Andrew W. Fitzgibbon, Oxford RRG
00009 // Created: 07 Aug 97
00010 //
00011 //-----------------------------------------------------------------------------
00012 
00013 #include "vbl_bounding_box.h"
00014 
00015 #include <vcl_iostream.h>
00016 
00017 template <class T, class DIM_>
00018 vcl_ostream& vbl_bounding_box_base<T, DIM_>::print(vcl_ostream& s) const
00019 {
00020   if (empty()) {
00021     s << "<bbox(empty, " << int(DIM_::value) << " dimensions)>";
00022   }
00023   else {
00024     s << "<bbox(";
00025     for (int i = 0; i < int(DIM_::value); ++i)
00026       s << min()[i] << ' ';
00027     s << ") to (";
00028     for (int i = 0; i < int(DIM_::value); ++i)
00029       s << max()[i] << ' ';
00030     s << ")>";
00031   }
00032   return s;
00033 }
00034 
00035 template <class T, class DIM_>
00036 vcl_ostream& operator << (vcl_ostream& s, const vbl_bounding_box_base<T,DIM_>& bbox)
00037 {
00038   return bbox.print(s);
00039 }
00040 
00041 #define VBL_BOUNDING_BOX_INSTANTIATE(T, DIM) \
00042 template class vbl_bounding_box_base<T , vbl_bounding_box_DIM< DIM > >; \
00043 template class vbl_bounding_box<T , DIM >; \
00044 template vcl_ostream& operator << (vcl_ostream&, vbl_bounding_box_base<T, vbl_bounding_box_DIM< DIM > > const&); \
00045 VCL_INSTANTIATE_INLINE(bool nested  (vbl_bounding_box_base<T , vbl_bounding_box_DIM< DIM > > const&, \
00046                                      vbl_bounding_box_base<T , vbl_bounding_box_DIM< DIM > > const&)); \
00047 VCL_INSTANTIATE_INLINE(bool disjoint(vbl_bounding_box_base<T , vbl_bounding_box_DIM< DIM > > const&, \
00048                                      vbl_bounding_box_base<T , vbl_bounding_box_DIM< DIM > > const&)); \
00049 VCL_INSTANTIATE_INLINE(bool meet    (vbl_bounding_box_base<T , vbl_bounding_box_DIM< DIM > > const&, \
00050                                      vbl_bounding_box_base<T , vbl_bounding_box_DIM< DIM > > const&))
00051 
00052 #endif // vbl_bounding_box_txx_