00001 00002 #ifndef rsdl_bounding_box_h_ 00003 #define rsdl_bounding_box_h_ 00004 00005 //: 00006 // \file 00007 // \brief Bounds on a rectangular region over a mix Cartesian and angular dimensions. 00008 // \author Chuck Stewart 00009 // \date June 2001 00010 // 00011 // A very simple class to represent a rectangular region that is 00012 // defined on coordinates that mix Cartesian and angular dimensions. 00013 // This is used in the k-d tree algorithm. Nc and Na must be 00014 // non-negative and Nc+Na>0. 00015 // 00016 // This class is effectively "read-only" (except for an assignment 00017 // operator). 00018 00019 00020 #include <rsdl/rsdl_point.h> 00021 00022 #include <vcl_iosfwd.h> 00023 00024 00025 class rsdl_bounding_box { 00026 private: 00027 //: default ctor is private! 00028 rsdl_bounding_box() {} 00029 00030 public: 00031 00032 //: Construct a region to enclose two points. 00033 // Note that if the numerical value of a min angle is 00034 // greater than that of a max angle, this is effectively be 00035 // treated as "wrapping around". The cartesian values of the 00036 // min_point and max_point are checked and reordered if inconsistent. 00037 rsdl_bounding_box( const rsdl_point& min_point, 00038 const rsdl_point& max_point ); 00039 00040 //: Copy constructor 00041 rsdl_bounding_box( const rsdl_bounding_box& old ); 00042 00043 //: Assignment operator 00044 rsdl_bounding_box& operator= ( const rsdl_bounding_box& old ); 00045 00046 //: Mutable access to lower bound cartesian value in dimension i. 00047 inline double& min_cartesian( unsigned int i ) { return min_point_.cartesian(i); } 00048 00049 //: Number of cartesian dimensions. 00050 inline unsigned int num_cartesian( ) const { return min_point_.num_cartesian(); } 00051 00052 //: Number of angular dimensions. 00053 inline unsigned int num_angular( ) const { return min_point_.num_angular(); } 00054 00055 //: Constant access to lower bound cartesian value in dimension i. 00056 inline const double& min_cartesian( unsigned int i ) const { return min_point_.cartesian(i); } 00057 00058 //: Mutable access to upper bound cartesian value in dimension i. 00059 inline double& max_cartesian( unsigned int i ) { return max_point_.cartesian(i); } 00060 00061 //: Constant access to upper bound cartesian value in dimension i 00062 inline const double& max_cartesian( unsigned int i ) const { return max_point_.cartesian(i); } 00063 00064 //: Mutable access to lower bound angular value in dimension i 00065 inline double& min_angular( unsigned int i ) { return min_point_.angular(i); } 00066 00067 //: Constant access to lower bound angular value in dimension i 00068 inline const double& min_angular( unsigned int i ) const { return min_point_.angular(i); } 00069 00070 //: Mutable access to upper bound angular value in dimension i 00071 inline double& max_angular( unsigned int i ) { return max_point_.angular(i); } 00072 00073 //: Constant access to upper bound angular value in dimension i 00074 inline const double& max_angular( unsigned int i ) const { return max_point_.angular(i); } 00075 00076 private: 00077 rsdl_point min_point_; 00078 rsdl_point max_point_; 00079 }; 00080 00081 vcl_ostream& operator<< ( vcl_ostream& ostr, const rsdl_bounding_box& box ); 00082 00083 #endif
1.4.4