aboutsummaryrefslogtreecommitdiff
path: root/src/core/ray.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/ray.rs')
-rw-r--r--src/core/ray.rs5
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
}