2023-12-23 22:56:27 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
2023-12-27 20:14:29 +01:00
|
|
|
#include "raytracer.h"
|
2023-12-23 22:56:27 +01:00
|
|
|
#include "vec3.h"
|
|
|
|
|
|
|
|
|
|
class Ray {
|
|
|
|
|
public:
|
2023-12-27 17:23:35 +01:00
|
|
|
constexpr Ray() = default;
|
2023-12-23 22:56:27 +01:00
|
|
|
|
2023-12-27 17:23:35 +01:00
|
|
|
constexpr Ray(const Point3& origin, const Vec3& direction) : orig_{origin}, dir_{direction} {}
|
2023-12-23 22:56:27 +01:00
|
|
|
|
|
|
|
|
Point3 origin() const { return orig_; }
|
|
|
|
|
Vec3 direction() const { return dir_; }
|
|
|
|
|
|
2023-12-27 20:14:29 +01:00
|
|
|
constexpr Point3 At(f64 t) const { return orig_ + t * dir_; }
|
2023-12-23 22:56:27 +01:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
Point3 orig_;
|
|
|
|
|
Vec3 dir_;
|
2023-12-27 17:23:35 +01:00
|
|
|
};
|