Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
35 lines (32 sloc) 1 KB
#ifndef RAYS_HPP
#define RAYS_HPP
#include "Vectors.hpp"
namespace raytracer
typedef Vector Point;
* A ray that starts from a origin and has a direction.
* Rays are modeled as per the equation P+D*t
* The variable t only ranges over nonnegative values,
* since the ray starts from the origin point. When t = 0,
* the ray is at point P, and as t increases, the ray moves
* in the direction of D.
class Ray
Point origin;
Vector direction;
* Constructor of a ray
* @param origin the origin that the ray is emitted from
* @param direction the direction that the ray is headed
* @param normalize boolean whether to normalize the ray
Ray(const Point& origin, const Vector direction, bool normalize=true);
const Point& get_origin() const;
const Vector& get_direction() const;
const Point get_point_at_t(float t) const;
#endif /*RAYS_HPP*/