Fixed bug in plane intersection test

This commit is contained in:
bijan-S 2021-05-05 21:48:22 -04:00
parent 6d2a1407bf
commit cd94c7ad6f

View file

@ -67,7 +67,7 @@ impl Surface for Plane {
fn intersect(&self, ray: Ray) -> Option<f32> {
let d = self.normal.dot(&ray.direction);
if d < 1e-3 { return None; }
if d > -1e-3 { return None; }
let t = (self.center - ray.origin).dot(&*self.normal) / d;