snoopy/src/ray.h

26 lines
432 B
C
Raw Normal View History

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_;
};