handle case where AAEllipsoid is entirely inside the AABox

This commit is contained in:
Seth Alves 2017-03-28 10:57:03 -07:00
parent 6f6343420c
commit 9789476a73

View file

@ -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;