diff --git a/src/math/point.rs b/src/math/point.rs index 05f7574..30e66dc 100644 --- a/src/math/point.rs +++ b/src/math/point.rs @@ -89,6 +89,14 @@ impl Sub for Point { } } +impl Sub for Point { + type Output = Point; + + fn sub(self, other: Vector) -> Point { + Point { co: self.co - other.co } + } +} + impl Mul for Point { type Output = Point; diff --git a/src/renderer.rs b/src/renderer.rs index 34017fc..f1c5e72 100644 --- a/src/renderer.rs +++ b/src/renderer.rs @@ -268,8 +268,8 @@ impl LightPath { let la = dot(rnor, shadow_vec.normalized()).max(0.0); self.light_attenuation = XYZ::from_spectral_sample(&XYZ::new(la, la, la) .to_spectral_sample(self.wavelength)); - *ray = Ray::new(pos + shadow_vec.normalized() * 0.0001, - shadow_vec, + *ray = Ray::new(pos + rnor * 0.0001, + shadow_vec - rnor * 0.0001, self.time, true);