X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgeometry%2Fboundingbox.h;h=4ae29354d2ce2b69b3c48478bf0928bb4ad35129;hb=2826730b5d68d1ad74dc6363af43ca796f96caa2;hp=120eedbfe9aae581cb09d1a03ee8ebebd5e7676c;hpb=09cc3a8648dd20e9a07d669b353c4a120b67c1c4;p=libs%2Fmath.git diff --git a/source/geometry/boundingbox.h b/source/geometry/boundingbox.h index 120eedb..4ae2935 100644 --- a/source/geometry/boundingbox.h +++ b/source/geometry/boundingbox.h @@ -27,7 +27,11 @@ public: T get_minimum_coordinate(unsigned i) const { return min_pt[i]; } const LinAl::Vector &get_maximum_point() const { return max_pt; } T get_maximum_coordinate(unsigned i) const { return max_pt[i]; } - bool is_empty() const { return empty; } + LinAl::Vector get_dimensions() const { return max_pt-min_pt; } + T get_dimension(unsigned i) const { return max_pt[i]-min_pt[i]; } + + bool is_empty() const { return empty && !negated; } + bool is_space() const { return empty && negated; } bool is_negated() const { return negated; } }; @@ -100,8 +104,8 @@ inline BoundingBox operator&(const BoundingBox &bb1, const BoundingB { for(unsigned i=0; iresult_max[i]) return BoundingBox(); } @@ -127,8 +131,8 @@ inline BoundingBox operator|(const BoundingBox &bb1, const BoundingB LinAl::Vector result_max; for(unsigned i=0; i(result_min, result_max);