use math::*;
use ray::Ray;

#[derive(Copy, Clone)]
pub struct Intersection {
    pub distance: f32,
    pub position: Point,
    pub normal: Vector,
}

impl Intersection {
    pub fn nearest(lhs: Self, rhs: Self) -> Intersection {
        if lhs.distance < rhs.distance {
            lhs
        } else {
            rhs
        }
    }
}

use math::*;
use ray::Ray;

#[derive(Copy, Clone)]
pub struct Intersection {
    pub distance: f32,
    pub position: Point,
    pub normal: Vector,
}

impl Intersection {
    pub fn nearest(lhs: Self, rhs: Self) -> Intersection {
        if lhs.distance > rhs.distance {
            lhs
        } else {
            rhs
        }
    }
}

--- 
+++ 
@@ -10,7 +10,7 @@
 
 impl Intersection {
     pub fn nearest(lhs: Self, rhs: Self) -> Intersection {
-        if lhs.distance > rhs.distance {
+        if lhs.distance < rhs.distance {
             lhs
         } else {
             rhs
Fix draw order of primitives
