You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
396 B
C
26 lines
396 B
C
5 months ago
|
#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
|
||
|
|