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
This commit is contained in:
parent
14b6735c1c
commit
9972ebdb41
@ -32,7 +32,7 @@ Shape::IntersectionList Cyl::intersect(refptr<Shape> _this, const Ray & ray)
|
|||||||
LinearSolver solver(-ray_inv.getDirection()[2],
|
LinearSolver solver(-ray_inv.getDirection()[2],
|
||||||
-ray_inv.getOrigin()[2]);
|
-ray_inv.getOrigin()[2]);
|
||||||
Solver::Result solutions = solver.solve();
|
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]];
|
Vector isect_point = ray_inv[solutions.results[0]];
|
||||||
if (isect_point[0]*isect_point[0] + isect_point[1]*isect_point[1]
|
if (isect_point[0]*isect_point[0] + isect_point[1]*isect_point[1]
|
||||||
@ -50,7 +50,7 @@ Shape::IntersectionList Cyl::intersect(refptr<Shape> _this, const Ray & ray)
|
|||||||
LinearSolver solver(ray_inv.getDirection()[2],
|
LinearSolver solver(ray_inv.getDirection()[2],
|
||||||
ray_inv.getOrigin()[2] - m_height);
|
ray_inv.getOrigin()[2] - m_height);
|
||||||
Solver::Result solutions = solver.solve();
|
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]];
|
Vector isect_point = ray_inv[solutions.results[0]];
|
||||||
if (isect_point[0]*isect_point[0] + isect_point[1]*isect_point[1]
|
if (isect_point[0]*isect_point[0] + isect_point[1]*isect_point[1]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user