vbl_bounding_box.hxx
Go to the documentation of this file.
1 // This is core/vbl/vbl_bounding_box.hxx
2 #ifndef vbl_bounding_box_hxx_
3 #define vbl_bounding_box_hxx_
4 
5 //-*- c++ -*-------------------------------------------------------------------
6 //
7 
8 // Author: Andrew W. Fitzgibbon, Oxford RRG
9 // Created: 07 Aug 97
10 //
11 //-----------------------------------------------------------------------------
12 
13 #include <iostream>
14 #include "vbl_bounding_box.h"
15 
16 #ifdef _MSC_VER
17 # include <vcl_msvc_warnings.h>
18 #endif
19 
20 template <class T, class DIM_>
21 std::ostream& vbl_bounding_box_base<T, DIM_>::print(std::ostream& s) const
22 {
23  if (empty()) {
24  s << "<bbox(empty, " << int(DIM_::value) << " dimensions)>";
25  }
26  else {
27  s << "<bbox(";
28  for (int i = 0; i < int(DIM_::value); ++i)
29  s << min()[i] << ' ';
30  s << ") to (";
31  for (int i = 0; i < int(DIM_::value); ++i)
32  s << max()[i] << ' ';
33  s << ")>";
34  }
35  return s;
36 }
37 
38 template <class T, class DIM_>
39 std::ostream& operator << (std::ostream& s, const vbl_bounding_box_base<T,DIM_>& bbox)
40 {
41  return bbox.print(s);
42 }
43 
44 #define VBL_BOUNDING_BOX_INSTANTIATE(T, DIM) \
45 template class vbl_bounding_box_base<T , vbl_bounding_box_DIM< DIM > >; \
46 template class vbl_bounding_box<T , DIM >; \
47 template std::ostream& operator << (std::ostream&, vbl_bounding_box_base<T, vbl_bounding_box_DIM< DIM > > const&); \
48 /* template bool nested (vbl_bounding_box_base<T , vbl_bounding_box_DIM< DIM > > const&, \
49  vbl_bounding_box_base<T , vbl_bounding_box_DIM< DIM > > const&); */ \
50 /* template bool disjoint(vbl_bounding_box_base<T , vbl_bounding_box_DIM< DIM > > const&, \
51  vbl_bounding_box_base<T , vbl_bounding_box_DIM< DIM > > const&); */ \
52 /* template bool meet (vbl_bounding_box_base<T , vbl_bounding_box_DIM< DIM > > const&, \
53  vbl_bounding_box_base<T , vbl_bounding_box_DIM< DIM > > const&) */
54 
55 #endif // vbl_bounding_box_hxx_
std::ostream & print(std::ostream &s) const
Contains a bounding box class.
std::ostream & operator<<(std::ostream &s, const vbl_bounding_box_base< T, DIM_ > &bbox)