00001 // This is core/vgl/algo/vgl_orient_box_3d_operators.h 00002 #ifndef vgl_orient_box_3d_operators_h 00003 #define vgl_orient_box_3d_operators_h 00004 //: 00005 // \file 00006 // \brief Compute the minimal oriented bounding box for several 3D shapes 00007 // \author Peter Vanroose 00008 // \date 16 October 2009 00009 // 00010 // Given a 3D geometric object like a set of points, an ellipsoid, ... 00011 // find the bounding box with the minimal volume that completely contains 00012 // the given object. "Bounding box" is defined here as a Euclidean box 00013 // (with mutually orthogonal rectangular faces), i.e., a vgl_orient_box_3d<T>. 00014 // 00015 // The class vgl_orient_box_3d_operators is actually a kind of namespace: 00016 // it is just a collection of static methods, all returning a minimal box. 00017 // 00018 // \verbatim 00019 // Modifications 00020 // 16-Oct-2009 Peter Vanroose - first (very minimal) version, only works for single-point input 00021 // \endverbatim 00022 00023 #include <vgl/algo/vgl_orient_box_3d.h> 00024 #include <vgl/vgl_box_3d.h> 00025 #include <vgl/vgl_point_3d.h> 00026 #include <vcl_vector.h> 00027 00028 template <class T> 00029 class vgl_orient_box_3d_operators 00030 { 00031 vgl_orient_box_3d_operators() {} // The default constructor is private 00032 public: 00033 00034 static vgl_orient_box_3d<T> minimal_box(vgl_point_3d<T> const& p) { 00035 vgl_box_3d<T> bb; bb.add(p); return bb; 00036 } 00037 00038 static vgl_orient_box_3d<T> minimal_box(vcl_vector<vgl_point_3d<T> > const& plist); 00039 }; 00040 00041 #define VGL_ORIENT_BOX_3D_OPERATORS_INSTANTIATE(T) extern "Please #include <vgl/vgl_orient_box_3d_operators.txx> instead" 00042 00043 #endif // vgl_orient_box_3d_operators_h