From 9789476a73e81e632a8f0a8a756dd02144cf7429 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Tue, 28 Mar 2017 10:57:03 -0700 Subject: [PATCH] handle case where AAEllipsoid is entirely inside the AABox --- libraries/shared/src/AABox.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libraries/shared/src/AABox.cpp b/libraries/shared/src/AABox.cpp index fa993856dd..b52deaa4ff 100644 --- a/libraries/shared/src/AABox.cpp +++ b/libraries/shared/src/AABox.cpp @@ -437,6 +437,7 @@ glm::vec3 AABox::getClosestPointOnFace(const glm::vec4& origin, const glm::vec4& } bool AABox::touchesAAEllipsoid(const glm::vec3& center, glm::vec3 radials) const { + // handle case where ellipsoid's alix-aligned box doesn't touch this AABox if (_corner.x - radials.x > center.x || _corner.y - radials.y > center.y || _corner.z - radials.z > center.z || @@ -446,6 +447,11 @@ bool AABox::touchesAAEllipsoid(const glm::vec3& center, glm::vec3 radials) const return false; } + // handle case where ellipsoid is entirely inside this AABox + if (contains(center)) { + return true; + } + for (int i = 0; i < FACE_COUNT; i++) { glm::vec3 closest = getClosestPointOnFace(center, (BoxFace)i) - center; float x = closest.x;