123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- #pragma once
- #include <Mathematics/TIQuery.h>
- #include <Mathematics/Halfspace.h>
- #include <Mathematics/OrientedBox.h>
- namespace WwiseGTE
- {
- template <typename Real>
- class TIQuery<Real, Halfspace3<Real>, OrientedBox3<Real>>
- {
- public:
- struct Result
- {
- bool intersect;
- };
- Result operator()(Halfspace3<Real> const& halfspace, OrientedBox3<Real> const& box)
- {
- Result result;
-
-
- Real center = Dot(halfspace.normal, box.center) - halfspace.constant;
-
- Real radius =
- std::fabs(box.extent[0] * Dot(halfspace.normal, box.axis[0])) +
- std::fabs(box.extent[1] * Dot(halfspace.normal, box.axis[1])) +
- std::fabs(box.extent[2] * Dot(halfspace.normal, box.axis[2]));
-
-
- result.intersect = (center + radius >= (Real)0);
- return result;
- }
- };
- }
|