first commit
This commit is contained in:
38
CS4451/proj1/ray.cpp
Normal file
38
CS4451/proj1/ray.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
#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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user