diff --git a/rtchallenge/src/intersections.rs b/rtchallenge/src/intersections.rs index 2802eb4..d0b16d9 100644 --- a/rtchallenge/src/intersections.rs +++ b/rtchallenge/src/intersections.rs @@ -7,11 +7,16 @@ use crate::{ Float, EPSILON, }; -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone)] pub struct Intersection<'i> { pub t: Float, pub object: &'i Shape, } +impl<'i> PartialEq for Intersection<'i> { + fn eq(&self, rhs: &Intersection) -> bool { + ((self.t - rhs.t).abs() < EPSILON) && (self.object == rhs.object) + } +} impl<'i> Intersection<'i> { /// Create new `Intersection` at the given `t` that hits the given `object`.