aboutsummaryrefslogtreecommitdiffstats
path: root/ray.h
diff options
context:
space:
mode:
Diffstat (limited to 'ray.h')
-rw-r--r--ray.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/ray.h b/ray.h
new file mode 100644
index 0000000..064dbf5
--- /dev/null
+++ b/ray.h
@@ -0,0 +1,25 @@
+#ifndef RAY_H
+#define RAY_H
+
+#include "vec3.h"
+
+class ray {
+ public:
+ ray() {}
+
+ ray(const point3& origin, const vec3& direction) : orig(origin), dir(direction) {}
+
+ const point3& origin() const { return orig; }
+ const vec3& direction() const { return dir; }
+
+ point3 at(double t) const {
+ return orig + t*dir;
+ }
+
+ private:
+ point3 orig;
+ vec3 dir;
+};
+
+#endif
+