2020-06-03 02:56:59 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "vec3.h"
|
|
|
|
|
|
|
|
class ray
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ray() {}
|
|
|
|
ray(const point3& origin, const vec3& direction) :
|
|
|
|
origin_(origin),
|
|
|
|
direction_(direction)
|
|
|
|
{}
|
|
|
|
|
|
|
|
point3 origin() const { return origin_; }
|
|
|
|
vec3 direction() const { return direction_; }
|
|
|
|
|
|
|
|
point3 at(double t) const
|
|
|
|
{
|
|
|
|
return origin_ + t * direction_;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
point3 origin_;
|
|
|
|
vec3 direction_;
|
|
|
|
};
|
2023-02-18 19:35:15 +01:00
|
|
|
|