diff --git a/rtchallenge/src/camera.rs b/rtchallenge/src/camera.rs index 08141b0..a2c6453 100644 --- a/rtchallenge/src/camera.rs +++ b/rtchallenge/src/camera.rs @@ -57,7 +57,7 @@ impl Camera { /// /// # Examples /// ``` - /// use rtchallenge::{camera::Camera, float::consts::PI, matrices::Matrix4x4}; + /// use rtchallenge::{camera::Camera, float::consts::PI, matrices::Matrix4x4, EPSILON}; /// /// let hsize = 160; /// let vsize = 120; @@ -69,11 +69,11 @@ impl Camera { /// /// // Pixel size for a horizontal canvas. /// let c = Camera::new(200, 150, PI / 2.); - /// assert_eq!(c.pixel_size(), 0.01); + /// assert!((c.pixel_size() - 0.010).abs() < EPSILON); /// /// // Pixel size for a horizontal canvas. /// let c = Camera::new(150, 200, PI / 2.); - /// assert_eq!(c.pixel_size(), 0.01); + /// assert!((c.pixel_size() - 0.010).abs() < EPSILON); /// ``` pub fn new(hsize: usize, vsize: usize, field_of_view: Float) -> Camera { let half_view = (field_of_view / 2.).tan(); diff --git a/rtchallenge/src/materials.rs b/rtchallenge/src/materials.rs index a65e4bc..e25aa31 100644 --- a/rtchallenge/src/materials.rs +++ b/rtchallenge/src/materials.rs @@ -84,7 +84,7 @@ impl Default for Material { /// let normalv = Tuple::vector(0., 0., -1.); /// let light = PointLight::new(Tuple::point(0., 10., -10.), WHITE); /// let result = lighting(&m, &light, position, eyev, normalv, in_shadow); -/// assert_eq!(result, Color::new(1.6363853, 1.6363853, 1.6363853)); +/// assert_eq!(result, Color::new(1.63639, 1.63639, 1.63639)); /// /// // Lighting with the light behind the surface. /// let eyev = Tuple::vector(0., 0., -1.);