branch | pyrit |
changeset 42 | fbdeb3e04543 |
parent 40 | 929aad02c5f2 |
child 44 | 3763b26244f0 |
--- a/src/scene.cc Tue Dec 18 12:36:01 2007 +0100 +++ b/src/scene.cc Sat Dec 29 13:53:33 2007 +0100 @@ -95,10 +95,10 @@ bool Sphere::intersect(const Ray &ray, Float &dist) const { Vector3 V = ray.o - center; - register Float d = -dot(V, ray.dir); + register Float d = dot(V, ray.dir); register Float Det = d * d - (dot(V,V) - sqr_radius); if (Det > 0) { - d -= sqrtf(Det); + d = -d - sqrtf(Det); if (d > 0 && d < dist) { dist = d;