From 642e0596912e3a8fe443b44e61229feeaa25974c Mon Sep 17 00:00:00 2001 From: Thomas Fischer <thomas.fischer@ufz.de> Date: Wed, 17 Oct 2012 15:08:50 +0200 Subject: [PATCH] added a new constructor that takes two iterators --- GeoLib/AxisAlignedBoundingBox.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/GeoLib/AxisAlignedBoundingBox.h b/GeoLib/AxisAlignedBoundingBox.h index 808c44f28ff..83aa417ab6a 100644 --- a/GeoLib/AxisAlignedBoundingBox.h +++ b/GeoLib/AxisAlignedBoundingBox.h @@ -45,6 +45,17 @@ public: * */ AABB ( const std::vector<GeoLib::Point*>* points ); + template <typename Iterator> + AABB(Iterator beg, Iterator end) + { + for (Iterator it(beg); it != end; it++) { + for (std::size_t k(0); k<3; k++) { + if ((*it)[k] < _min_pnt[k]) _min_pnt[k] = (*it)[k]; + if (_max_pnt[k] < (*it)[k]) _max_pnt[k] = (*it)[k]; + } + } + } + void update (GeoLib::Point const & pnt); /** * update axis aligned bounding box -- GitLab