From 9972ebdb41f604140979f518c42c2d6ad33baa30 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Sun, 8 Mar 2009 16:03:52 +0000 Subject: [PATCH] fixed nasty bug in shapes/Cyl where intersection results were being allowed if they were negative git-svn-id: svn://anubis/fart/trunk@192 7f9b0f55-74a9-4bce-be96-3c2cd072584d --- shapes/Cyl.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shapes/Cyl.cc b/shapes/Cyl.cc index d6c7291..4b45b49 100644 --- a/shapes/Cyl.cc +++ b/shapes/Cyl.cc @@ -32,7 +32,7 @@ Shape::IntersectionList Cyl::intersect(refptr _this, const Ray & ray) LinearSolver solver(-ray_inv.getDirection()[2], -ray_inv.getOrigin()[2]); Solver::Result solutions = solver.solve(); - if (solutions.numResults > 0) + if (solutions.numResults > 0 && solutions.results[0] > 0.0) { Vector isect_point = ray_inv[solutions.results[0]]; if (isect_point[0]*isect_point[0] + isect_point[1]*isect_point[1] @@ -50,7 +50,7 @@ Shape::IntersectionList Cyl::intersect(refptr _this, const Ray & ray) LinearSolver solver(ray_inv.getDirection()[2], ray_inv.getOrigin()[2] - m_height); Solver::Result solutions = solver.solve(); - if (solutions.numResults > 0) + if (solutions.numResults > 0 && solutions.results[0] > 0.0) { Vector isect_point = ray_inv[solutions.results[0]]; if (isect_point[0]*isect_point[0] + isect_point[1]*isect_point[1]