use crate::prelude::*;

#[derive(Debug, Clone, Copy)]
pub struct Ray {
    start: Pos3,
    dir: Dir3,
    time: Float,
}

impl Ray {
    pub fn new(start: Pos3, dir: Dir3, time: Float) -> Self {
        Self { start, dir, time }
    }

    pub fn start(self) -> Pos3 {
        self.start
    }

    pub fn dir(self) -> Dir3 {
        self.dir
    }

    pub fn time(self) -> Float {
        self.time
    }

    pub fn at(self, t: Float) -> Pos3 {
        self.start + self.dir * t
    }
}
