First commit

This commit is contained in:
David 2021-08-20 23:27:59 +02:00
commit b75663feab
7 changed files with 348 additions and 0 deletions

34
ray.hpp Normal file
View file

@ -0,0 +1,34 @@
#ifndef RAY_H
#define RAY_H
#include "vec3.hpp"
struct ray {
/* Attributes */
point3 origin;
vec3 direction;
/* Constructors */
// Default constructor. Everything gets set to 0
ray()
{
origin = vec3();
direction = vec3();
}
ray(const point3& origin, const vec3& direction)
{
this->origin = origin;
this->direction = direction;
}
// Returns position after time t
point3 at(double t) const
{
return origin + t*direction;
}
};
#endif