void limits(iterator_t begin, iterator_t end, point_t& obb_center, matrix_type const& obb_orientation, point_t& obb_low, point_t& obb_high) const { typename oriented_boundingbox<point_t>::matrix_type inv = obb_orientation.inverse(); // preset limits to min/max for local coordinates and global coordinates ( // to determine center ) obb_low = point_t::maximum(); obb_high = point_t::minimum(); point_t g_low = point_t::maximum(); point_t g_high = point_t::minimum(); while (begin != end) { // project point into normalized bounding box space point_t p = inv * ((*begin) - obb_center); for (unsigned i = 0; i != point_t::size; ++i) { obb_low[i] = std::min(obb_low[i], p[i]); obb_high[i] = std::max(obb_high[i], p[i]); } ++begin; } point_t mean = (obb_low + obb_high) / value_type(2); point_t dist = obb_high - obb_low; point_t delta = obb_orientation * (mean); obb_low = dist / value_type(-2); obb_high = dist / value_type(2); obb_center += delta; }