Skip to content
Snippets Groups Projects
Commit 959ebd5a authored by Yoel's avatar Yoel
Browse files

Ray added << to header, cleanup

parent a6c15fbd
No related branches found
No related tags found
No related merge requests found
......@@ -9,9 +9,11 @@ Ray::Ray(const util::Vec3& x0, const util::Vec3& arg_d, float tmin, float tmax,
else
d = arg_d;
}
// Returns the value of the ray function at t
util::Vec3 Ray::operator()(float t) const {
return x0 + (d * t);
}
// Check if t is within the rays bounds
bool Ray::in_range(float t) const {
return t <= tmax && t >= tmin;
}
......
......@@ -4,14 +4,12 @@
namespace cam {
class Ray {
public:
// Constructor
Ray(const util::Vec3& x0, const util::Vec3& d, float tmin, float tmax,
bool normalize);
// Operator
friend std::ostream& operator<<(std::ostream& os, const cam::Ray& rhs);
util::Vec3 operator()(float t) const;
// Methods
bool in_range(float t) const;
friend std::ostream& operator<<(std::ostream& os, const cam::Ray& rhs);
const util::Vec3 x0;
util::Vec3 d;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment