Go to the documentation of this file.00001
00002 #ifndef vgl_orient_box_3d_h
00003 #define vgl_orient_box_3d_h
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include <vgl/vgl_box_3d.h>
00019 #include <vgl/vgl_point_3d.h>
00020 #include <vnl/vnl_quaternion.h>
00021 #include <vcl_vector.h>
00022 #include <vcl_iosfwd.h>
00023
00024 template <class Type>
00025 class vgl_orient_box_3d
00026 {
00027 public:
00028 vgl_orient_box_3d() {}
00029
00030
00031 vgl_orient_box_3d(vgl_box_3d<Type> box);
00032
00033
00034 vgl_orient_box_3d(vgl_box_3d<Type> box, vnl_quaternion<double> orient);
00035
00036
00037
00038 vgl_orient_box_3d(vgl_point_3d<Type> const& p0, vgl_point_3d<Type> const& px, vgl_point_3d<Type> const& py, vgl_point_3d<Type> const& pz);
00039
00040 virtual ~vgl_orient_box_3d(void) {}
00041
00042 inline bool operator==(vgl_orient_box_3d<Type> const& obb) const {
00043 return obb.box_ == this->box_ && obb.orient_ == this->orient_;
00044 }
00045
00046
00047 Type width() const { return box_.width(); }
00048 Type height() const { return box_.height(); }
00049 Type depth() const { return box_.depth(); }
00050 inline Type volume() const { return box_.width()*box_.height()*box_.depth(); }
00051 vcl_vector<vgl_point_3d<Type> > corners();
00052
00053
00054 bool contains(Type const& x, Type const& y, Type const& z) const;
00055
00056
00057 bool contains(vgl_point_3d<Type> const& p) const
00058 {return contains(p.x(), p.y(), p.z());}
00059
00060 vcl_ostream& print(vcl_ostream& s) const;
00061
00062 vcl_istream& read(vcl_istream& s);
00063
00064 private:
00065
00066 vgl_box_3d<Type> box_;
00067
00068
00069 vnl_quaternion<double> orient_;
00070 };
00071
00072
00073
00074 template <class Type>
00075 vcl_ostream& operator<<(vcl_ostream& s, vgl_orient_box_3d<Type> const& p);
00076
00077
00078
00079 template <class Type>
00080 vcl_istream& operator>>(vcl_istream& is, vgl_orient_box_3d<Type>& p);
00081
00082 #define VGL_ORIENT_BOX_3D_INSTANTIATE(T) extern "Please #include <vgl/vgl_orient_box_3d.txx> instead"
00083
00084 #endif // vgl_orient_box_3d_h