12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- #pragma once
- #include <Mathematics/DistPointAlignedBox.h>
- #include <Mathematics/OrientedBox.h>
- namespace WwiseGTE
- {
- template <int N, typename Real>
- class DCPQuery<Real, Vector<N, Real>, OrientedBox<N, Real>>
- :
- public DCPQuery<Real, Vector<N, Real>, AlignedBox<N, Real>>
- {
- public:
- struct Result
- :
- public DCPQuery<Real, Vector<N, Real>, AlignedBox<N, Real>>::Result
- {
-
- };
- Result operator()(Vector<N, Real> const& point, OrientedBox<N, Real> const& box)
- {
-
-
- Vector<N, Real> diff = point - box.center;
- Vector<N, Real> closest;
- for (int i = 0; i < N; ++i)
- {
- closest[i] = Dot(diff, box.axis[i]);
- }
- Result result;
- this->DoQuery(closest, box.extent, result);
-
- result.boxClosest = box.center;
- for (int i = 0; i < N; ++i)
- {
- result.boxClosest += closest[i] * box.axis[i];
- }
- return result;
- }
- };
-
- template <int N, typename Real>
- using DCPPointOrientedBox = DCPQuery<Real, Vector<N, Real>, AlignedBox<N, Real>>;
- template <typename Real>
- using DCPPoint2OrientedBox2 = DCPPointOrientedBox<2, Real>;
- template <typename Real>
- using DCPPoint3OrientedBox3 = DCPPointOrientedBox<3, Real>;
- }
|