X-Git-Url: https://git.rohieb.name/MicroTrace.git/blobdiff_plain/a8137256e983a49f97ff1fbecd26a1a0372f7b0b..7dc19699bd3ae76b3802dfb43854fd88fea3ffc3:/Box.cxx diff --git a/Box.cxx b/Box.cxx index ef9f750..b1951e4 100644 --- a/Box.cxx +++ b/Box.cxx @@ -1,6 +1,6 @@ #include "Box.hxx" -Box::Box() +Box::Box() : m_min(-Infinity), m_max(Infinity) { } @@ -10,11 +10,15 @@ Box::~Box() Box::Box(const Box& b) { + m_min = b.m_min; + m_max = b.m_max; } Box& Box::operator=(const Box& b) { + m_min = b.m_min; + m_max = b.m_max; return *this; } @@ -26,9 +30,17 @@ Box::Clear() void Box::Extend(const Vec3f& a) { + // for all three coordinates, move m_max or m_min to the point + for(size_t i = 0; i < 3; i++) { + if(a[i] > m_max[i]) { + m_max[i] = a[i]; + } else if(a[i] < m_min[i]) { + m_min[i] = a[i]; + } // else: do nothing, coordinate is inside the box + } } -void +void Box::Extend(const Box& box) { }