diff --git a/geom/aabb.cpp b/geom/aabb.cpp index 03d1608a..a5258ba7 100644 --- a/geom/aabb.cpp +++ b/geom/aabb.cpp @@ -57,14 +57,7 @@ template util::point aabb::closest (point q) const { - point res; - - for (size_t i = 0; i < S; ++i) - res[i] = q[i] < p0[i] ? p0[i] : - q[i] > p1[i] ? p1[i] : - q[i]; - - return res; + return limit (q, p0, p1); } @@ -148,11 +141,7 @@ namespace util::debug { struct validator> { static bool is_valid (const aabb &b) { - for (size_t i = 0; i < S; ++i) - if (b.p1[i] < b.p0[i]) - return false; - - return true; + return all (b.p0 <= b.p1); } }; }