aboutsummaryrefslogtreecommitdiff
path: root/src/core/ray.rs
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2021-08-05 15:44:40 +0200
committerJulian T <julian@jtle.dk>2021-08-05 15:44:40 +0200
commit3ef8f4d918406eec6bdc29e0ebd883fabfac9b2e (patch)
treeaa4b1aac1e165821c16f222ebfb9212a9740e98b /src/core/ray.rs
parent45119506c0293fdde6cef35f6e6f82d4055b46b6 (diff)
Add picture for c5505ab84820248c6dba35fc06aef9e0ced183derendered
Diffstat (limited to 'src/core/ray.rs')
-rw-r--r--src/core/ray.rs35
1 files changed, 0 insertions, 35 deletions
diff --git a/src/core/ray.rs b/src/core/ray.rs
deleted file mode 100644
index 19d3cf1..0000000
--- a/src/core/ray.rs
+++ /dev/null
@@ -1,35 +0,0 @@
-//! The ray class used when probing the 3d scene
-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,
-}
-
-impl Ray {
- pub fn new(origin: Vector3f, direction: Vector3f) -> Ray {
- Ray {
- origin,
- direction,
- }
- }
-
- pub fn new_to(origin: Vector3f, target: Vector3f) -> Ray {
- let dir = (target - origin).norm();
- Ray {
- origin,
- direction: dir
- }
- }
-
- /// Resolve a point on the ray at time t
- pub fn at(&self, t: Float) -> Vector3f {
- self.origin + self.direction * t
- }
-}
-