00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef OLENA_CORE_BOX_HH
00029 # define OLENA_CORE_BOX_HH
00030
00031 namespace oln {
00032
00033
00034
00035
00036 template <class PointType>
00037 class box
00038 {
00039 public:
00040 typedef typename PointType::dpoint_type dpoint_type;
00041 typedef PointType point_type;
00042
00043 enum { d = point_type::dim };
00044
00045 box();
00046
00047 unsigned
00048 dim() const;
00049
00050 void
00051 add(point_type p);
00052
00053 void
00054 add(const box<PointType>& p);
00055
00056 bool
00057 overlay(unsigned dim, const box<PointType>& p) const;
00058
00059 void
00060 make_consistent();
00061
00062 point_type
00063 mass_center();
00064
00065 point_type
00066 box_center();
00067
00068 point_type
00069 mass_center() const;
00070
00071 point_type
00072 box_center() const;
00073
00074 point_type
00075 top() const;
00076
00077 unsigned
00078 card() const;
00079
00080 unsigned
00081 inner_boxes_card() const;
00082
00083 point_type
00084 bottom() const;
00085
00086 unsigned
00087 width() const;
00088
00089 unsigned
00090 height() const;
00091
00092 unsigned
00093 integrale() const;
00094
00095 float
00096 inner_boxes_mean_dim(unsigned i) const;
00097
00098 unsigned
00099 volume() const;
00100
00101 unsigned
00102 area() const;
00103
00104 float
00105 density() const;
00106
00107 float
00108 square_ratio() const;
00109
00110 private:
00111 bool not_consistent_;
00112 point_type top_;
00113 point_type bottom_;
00114 point_type mass_center_;
00115 point_type box_center_;
00116 float inner_boxes_mean_dim_[point_type::dim];
00117 unsigned card_;
00118 unsigned box_card_;
00119 dpoint_type dimension_;
00120 float mass_[point_type::dim];
00121 };
00122
00123 }
00124
00125 # include <oln/core/box.hxx>
00126
00127 #endif // OLENA_CORE_BOX_HH