diff options
author | Julian T <julian@jtle.dk> | 2021-07-31 14:02:52 +0200 |
---|---|---|
committer | Julian T <julian@jtle.dk> | 2021-07-31 14:02:52 +0200 |
commit | cee9bcf4a2c8ffbfe6487f7886b2247eaba1c92c (patch) | |
tree | 7fd405d9a3f6351d6341706fba50a8616d6c3a84 /src/core/ray.rs | |
parent | 55044e56304c8484b8ff52f362ab1c66c9c5ca93 (diff) |
Better documentation and cleanup
Diffstat (limited to 'src/core/ray.rs')
-rw-r--r-- | src/core/ray.rs | 5 |
1 files changed, 5 insertions, 0 deletions
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 } |