From cee9bcf4a2c8ffbfe6487f7886b2247eaba1c92c Mon Sep 17 00:00:00 2001 From: Julian T Date: Sat, 31 Jul 2021 14:02:52 +0200 Subject: Better documentation and cleanup --- src/core/ray.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/core/ray.rs') diff --git a/src/core/ray.rs b/src/core/ray.rs index 0517e50..19d3cf1 100644 --- a/src/core/ray.rs +++ b/src/core/ray.rs @@ -2,8 +2,12 @@ use crate::core::Vector3f; use crate::Float; +/// A ray that is sent into the world. +/// This is the main type used for testing intersections. pub struct Ray { + /// Origin of the ray pub origin: Vector3f, + /// Direction is assumed to be a unit vector. pub direction: Vector3f, } @@ -23,6 +27,7 @@ impl Ray { } } + /// Resolve a point on the ray at time t pub fn at(&self, t: Float) -> Vector3f { self.origin + self.direction * t } -- cgit v1.2.3