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> const& box)
00032 : box_(box), orient_(vnl_quaternion<double>(vnl_vector_fixed<double,3>(0.0,0.0,1.0), 0.0)) {}
00033
00034
00035 vgl_orient_box_3d(vgl_box_3d<Type> const& box, vnl_quaternion<double> const& orient)
00036 : box_(box), orient_(orient) {}
00037
00038
00039
00040
00041 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);
00042
00043 virtual ~vgl_orient_box_3d(void) {}
00044
00045 inline bool operator==(vgl_orient_box_3d<Type> const& obb) const {
00046 return obb.box_ == this->box_ && obb.orient_ == this->orient_;
00047 }
00048
00049
00050 Type width() const { return box_.width(); }
00051 Type height() const { return box_.height(); }
00052 Type depth() const { return box_.depth(); }
00053 inline Type volume() const { return box_.width()*box_.height()*box_.depth(); }
00054 vcl_vector<vgl_point_3d<Type> > corners();
00055
00056
00057 bool contains(Type const& x, Type const& y, Type const& z) const;
00058
00059
00060 bool contains(vgl_point_3d<Type> const& p) const {return contains(p.x(), p.y(), p.z());}
00061
00062 vcl_ostream& print(vcl_ostream& s) const;
00063
00064 vcl_istream& read(vcl_istream& s);
00065
00066 private:
00067
00068 vgl_box_3d<Type> box_;
00069
00070
00071 vnl_quaternion<double> orient_;
00072 };
00073
00074
00075
00076 template <class Type>
00077 vcl_ostream& operator<<(vcl_ostream& s, vgl_orient_box_3d<Type> const& p);
00078
00079
00080
00081 template <class Type>
00082 vcl_istream& operator>>(vcl_istream& is, vgl_orient_box_3d<Type>& p);
00083
00084 #define VGL_ORIENT_BOX_3D_INSTANTIATE(T) extern "Please #include <vgl/vgl_orient_box_3d.txx> instead"
00085
00086 #endif // vgl_orient_box_3d_h