Fixes for test when using Float == f64.

This commit is contained in:
Bill Thiede 2021-07-18 17:27:31 -07:00
parent 95de5863cc
commit 1c06833658
2 changed files with 4 additions and 4 deletions

View File

@ -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();

View File

@ -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.);