From 26a198599263f07a70aee18c9144817f15d07cf6 Mon Sep 17 00:00:00 2001 From: David Rose Date: Tue, 16 Oct 2007 19:08:46 +0000 Subject: [PATCH] fix nearly-parallel case --- panda/src/mathutil/plane_src.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/panda/src/mathutil/plane_src.cxx b/panda/src/mathutil/plane_src.cxx index e12cc93705..73e0861d9c 100644 --- a/panda/src/mathutil/plane_src.cxx +++ b/panda/src/mathutil/plane_src.cxx @@ -135,6 +135,11 @@ intersects_parabola(FLOATTYPE &t1, FLOATTYPE &t2, FLOATTYPE b = normal.dot(parabola.get_b()); FLOATTYPE c = normal.dot(parabola.get_c()) + _v.v._3; + if (IS_NEARLY_ZERO(a)) { + // No intersection. + return false; + } + // Now use the quadratic equation to solve for t. FLOATTYPE discriminant = b * b - 4.0 * a * c; if (discriminant < 0.0f) {