39 lines
557 B
C++
39 lines
557 B
C++
#include <math.h>
|
|
#include <ostream>
|
|
#include <stdlib.h>
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
#include "defs.h"
|
|
#include "functions.h"
|
|
|
|
|
|
Ray::Ray (Point start, Point end) {
|
|
this->direction = (end-start);
|
|
this->origin = end;
|
|
}
|
|
|
|
Ray Ray::operator+(Ray &other) {
|
|
Ray r;
|
|
|
|
r.direction = direction + other.direction;
|
|
r.origin = origin + other.origin;
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
Ray Ray::operator-(Ray &other) {
|
|
Ray r;
|
|
|
|
r.direction = direction - other.direction;
|
|
r.origin = origin - other.origin;
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|