-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRay.cpp
More file actions
50 lines (44 loc) · 670 Bytes
/
Copy pathRay.cpp
File metadata and controls
50 lines (44 loc) · 670 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
40
41
42
43
44
45
46
47
48
49
50
/* Russell Smith
* russellsmith@csu.fullerton.edu
* CS 566
* February 18, 2011
*/
#include "Ray.h"
Ray::Ray() :
start(0.f, 0.f, 0.f),
end(0.f, 0.f, 0.f),
depth(0)
{
}
Ray::Ray(msgfx::Vector3f startPoint, msgfx::Vector3f endPoint) :
start(startPoint),
end(endPoint),
depth(0)
{
}
Ray::~Ray( )
{
// Nothing to free
}
const msgfx::Vector3f& Ray::Start()
{
return start;
}
const msgfx::Vector3f& Ray::End()
{
return end;
}
msgfx::Vector3f Ray::Direction()
{
msgfx::Vector3f dir(end - start);
dir.normalize();
return dir;
}
void Ray::Start(msgfx::Vector3f startPoint)
{
start = startPoint;
}
void Ray::End(msgfx::Vector3f endPoint)
{
end = endPoint;
}