// David Eberly, Geometric Tools, Redmond WA 98052 // Copyright (c) 1998-2020 // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt // https://www.geometrictools.com/License/Boost/LICENSE_1_0.txt // Version: 4.0.2019.08.13 #pragma once #include #include #include // The queries consider the box to be a solid. // // The aligned-aligned queries use simple min-max comparisions. The // interesection of aligned boxes is an aligned box, possibly degenerate, // where min[d] == max[d] for at least one dimension d. namespace WwiseGTE { template class TIQuery, AlignedBox2> { public: struct Result { bool intersect; }; Result operator()(AlignedBox2 const& box0, AlignedBox2 const& box1) { Result result; for (int i = 0; i < 2; i++) { if (box0.max[i] < box1.min[i] || box0.min[i] > box1.max[i]) { result.intersect = false; return result; } } result.intersect = true; return result; } }; template class FIQuery, AlignedBox2> { public: struct Result { bool intersect; AlignedBox2 box; }; Result operator()(AlignedBox2 const& box0, AlignedBox2 const& box1) { Result result; for (int i = 0; i < 2; i++) { if (box0.max[i] < box1.min[i] || box0.min[i] > box1.max[i]) { result.intersect = false; return result; } } for (int i = 0; i < 2; i++) { if (box0.max[i] <= box1.max[i]) { result.box.max[i] = box0.max[i]; } else { result.box.max[i] = box1.max[i]; } if (box0.min[i] <= box1.min[i]) { result.box.min[i] = box1.min[i]; } else { result.box.min[i] = box0.min[i]; } } result.intersect = true; return result; } }; }