1 // This is core/vgl/algo/vgl_orient_box_3d_operators.h
2 #ifndef vgl_orient_box_3d_operators_h
3 #define vgl_orient_box_3d_operators_h
4 //:
5 // \file
6 // \brief Compute the minimal oriented bounding box for several 3D shapes
7 // \author Peter Vanroose
8 // \date   16 October 2009
9 //
10 // Given a 3D geometric object like a set of points, an ellipsoid, ...
11 // find the bounding box with the minimal volume that completely contains
12 // the given object. "Bounding box" is defined here as a Euclidean box
13 // (with mutually orthogonal rectangular faces), i.e., a vgl_orient_box_3d<T>.
14 //
15 // The class vgl_orient_box_3d_operators is actually a kind of namespace:
16 // it is just a collection of static methods, all returning a minimal box.
17 //
18 // \verbatim
19 //  Modifications
20 //   16-Oct-2009 Peter Vanroose - first (very minimal) version, only works for single-point input
21 // \endverbatim
22 
23 #include <vector>
24 #include <vgl/algo/vgl_orient_box_3d.h>
25 #include <vgl/vgl_box_3d.h>
26 #include <vgl/vgl_point_3d.h>
27 #ifdef _MSC_VER
28 #  include <vcl_msvc_warnings.h>
29 #endif
30 
31 template <class T>
32 class vgl_orient_box_3d_operators
33 {
34   vgl_orient_box_3d_operators() = default; // The default constructor is private
35  public:
36 
minimal_box(vgl_point_3d<T> const & p)37   static vgl_orient_box_3d<T> minimal_box(vgl_point_3d<T> const& p) {
38     vgl_box_3d<T> bb; bb.add(p); return bb;
39   }
40 
41   static vgl_orient_box_3d<T> minimal_box(std::vector<vgl_point_3d<T> > const& plist);
42 };
43 
44 #define VGL_ORIENT_BOX_3D_OPERATORS_INSTANTIATE(T) extern "Please #include <vgl/vgl_orient_box_3d_operators.hxx> instead"
45 
46 #endif // vgl_orient_box_3d_operators_h
47