aboutsummaryrefslogtreecommitdiff
path: root/lib/ray.rb
diff options
context:
space:
mode:
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