X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;ds=sidebyside;f=src%2Fgeometry%2Fgeometry.cpp;h=002c68f0d1ba69760b65d41049e069a2ef2d490a;hb=bda41b98427c8d34f954dae0dcaf261c5ad6cb43;hp=1c1bfd61655bf8e2225d681c35984798f400da56;hpb=d220b0348951ce210ad4ea18dbe9934dd2999a60;p=gong.git diff --git a/src/geometry/geometry.cpp b/src/geometry/geometry.cpp index 1c1bfd6..002c68f 100644 --- a/src/geometry/geometry.cpp +++ b/src/geometry/geometry.cpp @@ -46,6 +46,16 @@ std::ostream &operator <<(std::ostream &out, const AABB &box) { return out << "AABB(" << box.min << ", " << box.max << ')'; } +bool Intersection(const AABB &a, const AABB &b) noexcept { + if (a.max.x < b.min.x) return false; + if (b.max.x < a.min.x) return false; + if (a.max.y < b.min.y) return false; + if (b.max.y < a.min.y) return false; + if (a.max.z < b.min.z) return false; + if (b.max.z < a.min.z) return false; + return true; +} + std::ostream &operator <<(std::ostream &out, const Ray &ray) { return out << "Ray(" << ray.orig << ", " << ray.dir << ')'; }