-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRay.cpp
More file actions
39 lines (29 loc) · 668 Bytes
/
Ray.cpp
File metadata and controls
39 lines (29 loc) · 668 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//
// Created by Jiang Kairong on 3/7/18.
//
#include "Ray.h"
Ray::Ray(const Vector3d &s, const Vector3d &d, bool isInside) : s(s), d(d.normalize()), isInside(isInside) {}
Vector3d Ray::getPoint(double t) {
return s + d.normalize() * t;
}
const Vector3d &Ray::getS() const {
return s;
}
void Ray::setS(const Vector3d &s) {
Ray::s = s;
}
const Vector3d &Ray::getD() const{
return d;
}
void Ray::setD(const Vector3d &d) {
Ray::d = d.normalize();
}
const Vector3d Ray::getPoint(double t) const {
return s + d.normalize() * t;
}
bool Ray::isIsInside() const {
return isInside;
}
void Ray::setIsInside(bool isInside) {
Ray::isInside = isInside;
}