From 7d05598cd728fbbb1c0b7a6e3a0c6bff10337696 Mon Sep 17 00:00:00 2001 From: georges <> Date: Fri, 16 Feb 2001 00:27:28 +0000 Subject: [PATCH] stop me before I make another ridiculous micro-optimization --- panda/src/mathutil/boundingSphere.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/panda/src/mathutil/boundingSphere.cxx b/panda/src/mathutil/boundingSphere.cxx index e15333279e..6f505cd058 100644 --- a/panda/src/mathutil/boundingSphere.cxx +++ b/panda/src/mathutil/boundingSphere.cxx @@ -396,7 +396,7 @@ contains_lineseg(const LPoint3f &a, const LPoint3f &b) const { // Tangent. t1 = t2 = -B / (2.0*A); return (t1 >= 0.0 && t1 <= 1.0) ? - IF_possible | IF_some : IF_no_intersection; + IF_possible | IF_some : IF_no_intersection; } if (radical < 0.0) { @@ -404,9 +404,11 @@ contains_lineseg(const LPoint3f &a, const LPoint3f &b) const { return IF_no_intersection; } + float reciprocal_2A = 1.0f/(2.0*A); float sqrt_radical = sqrtf(radical); - t1 = ( -B - sqrt_radical ) / (2.0*A); - t2 = ( -B + sqrt_radical ) / (2.0*A); + + t1 = ( -B - sqrt_radical ) * reciprocal_2A; + t2 = ( -B + sqrt_radical ) * reciprocal_2A; if (t1 >= 0.0 && t2 <= 1.0) { return IF_possible | IF_some | IF_all;