aboutsummaryrefslogtreecommitdiff
path: root/lib/ray.rb
diff options
context:
space:
mode:
authorNat Lasseter <user@4574.co.uk>2024-06-12 17:37:40 +0100
committerNat Lasseter <user@4574.co.uk>2024-06-12 17:37:40 +0100
commitdf7c4a808d691e1d927047bb86aa9738780e694d (patch)
treeda197b87ebf2c48fe27b9aabf2db1fff5786c7f4 /lib/ray.rb
Initial Commit (Up to Chapter 7)
Diffstat (limited to 'lib/ray.rb')
-rw-r--r--lib/ray.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/ray.rb b/lib/ray.rb
new file mode 100644
index 0000000..4d282cb
--- /dev/null
+++ b/lib/ray.rb
@@ -0,0 +1,12 @@
+class Ray
+ def initialize(origin = Point.new, direction = Vec3.new)
+ @origin = origin
+ @direction = direction
+ end
+
+ attr_reader :origin, :direction
+
+ def at(time)
+ @origin + (@direction * time)
+ end
+end