123456789101112131415161718192021222324252627282930313233343536373839 |
- #pragma once
- #include <Mathematics/TIQuery.h>
- #include <Mathematics/DistPoint3Plane3.h>
- #include <Mathematics/Hyperellipsoid.h>
- #include <Mathematics/Matrix3x3.h>
- namespace WwiseGTE
- {
- template <typename Real>
- class TIQuery<Real, Plane3<Real>, Ellipsoid3<Real>>
- {
- public:
- struct Result
- {
- bool intersect;
- };
- Result operator()(Plane3<Real> const& plane, Ellipsoid3<Real> const& ellipsoid)
- {
- Result result;
- Matrix3x3<Real> MInverse;
- ellipsoid.GetMInverse(MInverse);
- Real discr = Dot(plane.normal, MInverse * plane.normal);
- Real root = std::sqrt(std::max(discr, (Real)0));
- DCPQuery<Real, Vector3<Real>, Plane3<Real>> vpQuery;
- Real distance = vpQuery(ellipsoid.center, plane).distance;
- result.intersect = (distance <= root);
- return result;
- }
- };
- }
|