IntrCapsule3Capsule3.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  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/DistSegmentSegment.h>
  10. #include <Mathematics/Capsule.h>
  11. namespace WwiseGTE
  12. {
  13. template <typename Real>
  14. class TIQuery<Real, Capsule3<Real>, Capsule3<Real>>
  15. {
  16. public:
  17. struct Result
  18. {
  19. bool intersect;
  20. };
  21. Result operator()(Capsule3<Real> const& capsule0, Capsule3<Real> const& capsule1)
  22. {
  23. Result result;
  24. DCPQuery<Real, Segment3<Real>, Segment3<Real>> ssQuery;
  25. auto ssResult = ssQuery(capsule0.segment, capsule1.segment);
  26. Real rSum = capsule0.radius + capsule1.radius;
  27. result.intersect = (ssResult.distance <= rSum);
  28. return result;
  29. }
  30. };
  31. }