From df7c4a808d691e1d927047bb86aa9738780e694d Mon Sep 17 00:00:00 2001 From: Nat Lasseter Date: Wed, 12 Jun 2024 17:37:40 +0100 Subject: Initial Commit (Up to Chapter 7) --- lib/ray.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 lib/ray.rb (limited to 'lib/ray.rb') 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 -- cgit v1.2.1