From 910570bf37e2a4fe3ec938d0a60a95a5ea3480dc Mon Sep 17 00:00:00 2001 From: Jon Janzen Date: Fri, 11 Mar 2022 18:23:26 -0700 Subject: [PATCH] Can create ray --- features/src/ray.rs | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/features/src/ray.rs b/features/src/ray.rs index de59619..0491fea 100644 --- a/features/src/ray.rs +++ b/features/src/ray.rs @@ -1,11 +1,31 @@ use crate::structs::Tuple; +struct Ray { + origin: Tuple, + direction: Tuple, +} + +impl Ray { + fn new(origin: Tuple, direction: Tuple) -> Ray { + Ray { + origin, + direction, + } + } +} + #[cfg(test)] mod tests { + use super::*; #[test] - pub fn time_to_work() { - assert_eq!(true, true); + pub fn create_a_ray() { + let origin = Tuple::point(1, 2, 3); + let direction = Tuple::vector(4, 5, 6); + + let ray = Ray::new(origin, direction); + assert_eq!(ray.origin, origin); + assert_eq!(ray.direction, direction); } }