# T3 Create the Ray class (easy)

### Tutorial

{% embed url="<https://raytracing.github.io/books/RayTracingInOneWeekend.html#rays,asimplecamera,andbackground>" %}

Create ray.h under the **src** directory.

A Ray is defined by a point and a vector (preferrably normalised), we can define the Ray class as follows (we are following our tutorial to use the lower case **ray** as the class name):

```cpp
#ifndef RAY_H
#define RAY_H

#include "vec3.h"

class ray {
  private:
    point3 orig;
    vec3 dir;

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

#endif
```
