Fixed bug in plane intersection test
This commit is contained in:
parent
6d2a1407bf
commit
cd94c7ad6f
|
@ -67,7 +67,7 @@ impl Surface for Plane {
|
||||||
fn intersect(&self, ray: Ray) -> Option<f32> {
|
fn intersect(&self, ray: Ray) -> Option<f32> {
|
||||||
|
|
||||||
let d = self.normal.dot(&ray.direction);
|
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;
|
let t = (self.center - ray.origin).dot(&*self.normal) / d;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue