e68ef4021f5ff755f0069c34ed6cbd8e8f7fca6c
[MicroTrace.git] / Box.cxx
1 #include "Box.hxx"
2
3 Box::Box() : m_min(Infinity, Infinity, Infinity),
4 m_max(-Infinity, -Infinity, -Infinity)
5 {
6 }
7
8 Box::Box(Vec3f min, Vec3f max) : m_min(min), m_max(max)
9 {
10 }
11
12 Box::~Box()
13 {
14 }
15
16 Box::Box(const Box& b)
17 {
18 m_min = b.m_min;
19 m_max = b.m_max;
20 }
21
22 Box&
23 Box::operator=(const Box& b)
24 {
25 m_min = b.m_min;
26 m_max = b.m_max;
27 return *this;
28 }
29
30 void
31 Box::Clear()
32 {
33 }
34
35 void
36 Box::Extend(const Vec3f& a)
37 {
38 // for all three coordinates, move m_max or m_min to the point
39 for(size_t i = 0; i < 3; i++) {
40 if(a[i] > m_max[i]) {
41 m_max[i] = a[i];
42 } else if(a[i] < m_min[i]) {
43 m_min[i] = a[i];
44 } // else: do nothing, coordinate is inside the box
45 }
46 }
47
48 void
49 Box::Extend(const Box& box)
50 {
51 }
52
53 bool
54 Box::Overlaps(const Box& b) const
55 {
56 return false;
57 }
58
59 void
60 Box::Clip(const Ray& ray, float& tnear, float& tfar) const
61 {
62 }
63
64 const Vec3f&
65 Box::min() const
66 {
67 return m_min;
68 }
69
70 const Vec3f&
71 Box::max() const
72 {
73 return m_max;
74 }
This page took 0.041024 seconds and 3 git commands to generate.