You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
428 B
23 lines
428 B
2 years ago
|
#ifndef RAYH
|
||
|
#define RAYH
|
||
|
#include "vec3.h"
|
||
|
|
||
|
class ray {
|
||
|
public:
|
||
|
ray() {}
|
||
|
ray(const vec3& a, const vec3& b) {
|
||
|
O = a;
|
||
|
D = b;
|
||
|
}
|
||
|
vec3 origin() const { return O; }
|
||
|
vec3 direction() const { return D; }
|
||
|
inline vec3 point_at_parameter(float t) const {
|
||
|
return vec3(D * t + O);
|
||
|
}
|
||
|
|
||
|
vec3 O; //center(origin) point
|
||
|
vec3 D; //direction vector
|
||
|
};
|
||
|
|
||
|
#endif
|