ContCone.h 728 B

12345678910111213141516171819202122
  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.29
  7. #pragma once
  8. #include <Mathematics/Cone.h>
  9. namespace WwiseGTE
  10. {
  11. // Test for containment of a point by a cone.
  12. template <int N, typename Real>
  13. bool InContainer(Vector<N, Real> const& point, Cone<N, Real> const& cone)
  14. {
  15. Vector<N, Real> diff = point - cone.ray.origin;
  16. Real h = Dot(cone.ray.direction, diff);
  17. return cone.HeightInRange(h) && h * h >= cone.cosAngleSqr * Dot(diff, diff);
  18. }
  19. }