From 11ba10b557d9c4a099f08a487899c330efcb4ce4 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Mon, 6 Mar 2017 19:34:54 -1000 Subject: [PATCH] Add CAABox::intersectionRadius() --- include/zeus/CAABox.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/zeus/CAABox.hpp b/include/zeus/CAABox.hpp index 0a15af3..0c100cb 100644 --- a/include/zeus/CAABox.hpp +++ b/include/zeus/CAABox.hpp @@ -106,6 +106,12 @@ public: return distanceFromPointSquared(other.position) <= other.radius * other.radius; } + float intersectionRadius(const CSphere& other) const + { + float dist = distanceFromPoint(other.position); + return (dist < other.radius) ? dist : -1.f; + } + inline CAABox booleanIntersection(const CAABox& other) const { CVector3f minVec = CVector3f::skZero;