IntrSphere3Frustum3.h 997 B

12345678910111213141516171819202122232425262728293031323334
  1. // David Eberly, Geometric Tools, Redmond WA 98052
  2. // Copyright (c) 1998-2020
  3. // Distributed under the Boost Software License, Version 1.0.
  4. // https://www.boost.org/LICENSE_1_0.txt
  5. // https://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
  6. // Version: 4.0.2019.08.13
  7. #pragma once
  8. #include <Mathematics/TIQuery.h>
  9. #include <Mathematics/DistPoint3Frustum3.h>
  10. #include <Mathematics/Hypersphere.h>
  11. namespace WwiseGTE
  12. {
  13. template <typename Real>
  14. class TIQuery<Real, Sphere3<Real>, Frustum3<Real>>
  15. {
  16. public:
  17. struct Result
  18. {
  19. bool intersect;
  20. };
  21. Result operator()(Sphere3<Real> const& sphere, Frustum3<Real> const& frustum)
  22. {
  23. Result result;
  24. DCPQuery<Real, Vector3<Real>, Frustum3<Real>> vfQuery;
  25. Real distance = vfQuery(sphere.center, frustum).distance;
  26. result.intersect = (distance <= sphere.radius);
  27. return result;
  28. }
  29. };
  30. }