From fd74ea21f55aae52fb60e88185a5a3e8258f0ca0 Mon Sep 17 00:00:00 2001 From: David Rose Date: Tue, 23 Oct 2007 00:36:45 +0000 Subject: [PATCH] minor optimization? --- panda/src/mathutil/boundingBox.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/panda/src/mathutil/boundingBox.cxx b/panda/src/mathutil/boundingBox.cxx index a27d5d7a6b..f7c875bb3b 100644 --- a/panda/src/mathutil/boundingBox.cxx +++ b/panda/src/mathutil/boundingBox.cxx @@ -596,6 +596,15 @@ contains_box(const BoundingBox *box) const { //////////////////////////////////////////////////////////////////// int BoundingBox:: contains_hexahedron(const BoundingHexahedron *hexahedron) const { + // First, try the quick bounding-box test. If that's decisive, + // we'll accept it. + int result = contains_finite(hexahedron); + if (result == IF_no_intersection || ((result & IF_all) != 0)) { + return result; + } + + // If that was inconclusive, we'll look more closely with the + // somewhat more expensive reverse answer. return hexahedron->contains_box(this) & ~IF_all; }