2019-05-07 01:05:16 +02:00
|
|
|
#pragma once
|
|
|
|
|
2020-04-04 23:59:13 +02:00
|
|
|
#include <math/vec3.hh>
|
2019-05-07 01:05:16 +02:00
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
struct bounding_box
|
|
|
|
{
|
2020-03-29 14:45:43 +02:00
|
|
|
vec3_t<T> x1_, x2_;
|
2019-05-07 01:05:16 +02:00
|
|
|
|
|
|
|
bounding_box(void)
|
|
|
|
{ }
|
|
|
|
|
2020-03-29 14:45:43 +02:00
|
|
|
bounding_box( const vec3_t<T>& x1, const vec3_t<T>& x2)
|
2019-05-07 01:05:16 +02:00
|
|
|
: x1_(x1), x2_(x2)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
bounding_box(const bounding_box &a)
|
|
|
|
: x1_(a.x1_), x2_(a.x2_)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
bounding_box &operator/=(const bounding_box<T> &b)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < 3; ++i)
|
|
|
|
{
|
|
|
|
x1_[i] = std::max<T>(x1_[i], b.x1_[i]);
|
|
|
|
x2_[i] = std::min<T>(x2_[i], b.x2_[i]);
|
|
|
|
}
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|