3#include <Magnum/Magnum.h>
9template <
size_t size,
class T>
12 typedef Magnum::Math::Vector<size, float>
PointType;
45 return (this->
max + this->
min) * (T)0.5;
50 this->
min[0] = +std::numeric_limits<T>::infinity();
51 this->
min[1] = +std::numeric_limits<T>::infinity();
52 this->
min[2] = +std::numeric_limits<T>::infinity();
54 this->
max[0] = -std::numeric_limits<T>::infinity();
55 this->
max[1] = -std::numeric_limits<T>::infinity();
56 this->
max[2] = -std::numeric_limits<T>::infinity();
62 return this->
max - this->
min;
68 return this->
size() * (T)0.5;
89 return (p[0] >= this->
min[0] && p[0] <= this->
max[0]) &&
90 (p[1] >= this->
min[1] && p[1] <= this->
max[1]) &&
91 (p[2] >= this->
min[2] && p[2] <= this->
max[2]);
BoundingBox< 1, float > BoundingBox1f
Definition BoundingBox.h:100
BoundingBox< 4, float > BoundingBox4f
Definition BoundingBox.h:103
BoundingBox< 3, float > BoundingBox3f
Definition BoundingBox.h:102
BoundingBox< 2, float > BoundingBox2f
Definition BoundingBox.h:101
void cwiseMinInplace(Magnum::Math::Vector< size, T > &a, const Magnum::Math::Vector< size, T > &b)
Calculate the component-wise minimum of the given vectors and stores it into the first given vector.
Definition Utils.h:24
void cwiseMaxInplace(Magnum::Math::Vector< size, T > &a, const Magnum::Math::Vector< size, T > &b)
Calculate the component-wise maximum of the given vectors and stores it into the first given vector.
Definition Utils.h:51
A generic 3D axis-aligned bounding box defined by its minimum and maximum points.
Definition BoundingBox.h:10
Magnum::Math::Vector< size, float > PointType
The type of points that make up this box.
Definition BoundingBox.h:12
BoundingBox(const PointType &min, const PointType &max)
Creates a new minimal bounding box containing the two points. The given minimum point has to be small...
Definition BoundingBox.h:28
bool contains(const PointType &p) const
Checks if the given point is contained within this bounding box.
Definition BoundingBox.h:88
void expandBy(const BoundingBox &other)
Minimally expand this box to encompass the given bounding box.
Definition BoundingBox.h:80
bool operator!=(const BoundingBox &other) const
Compares this bounding box to another and checks if they are not equal.
Definition BoundingBox.h:38
void reset()
Resets this bounding box to an undefined state.
Definition BoundingBox.h:49
BoundingBox()
Constructs a new empty bounding box.
Definition BoundingBox.h:15
BoundingBox(const PointType &p)
Creates a new bounding box contained the given point with zero size.
Definition BoundingBox.h:21
PointType extends() const
Returns the extends of this bounding box, this equal to half the size or the distance from the center...
Definition BoundingBox.h:67
PointType max
Component-wise maximum.
Definition BoundingBox.h:97
PointType size() const
Returns the size of this bounding box. The result of this method on an undefined bounding box will be...
Definition BoundingBox.h:61
PointType min
Component-wise minimum.
Definition BoundingBox.h:95
void expandBy(const PointType &p)
Minimally expand this box to encompass the given point.
Definition BoundingBox.h:73
bool operator==(const BoundingBox &other) const
Compares this bounding box to another and checks if they are equal.
Definition BoundingBox.h:33
PointType center() const
Returns the center of this bounding box. The result of this method on an undefined bounding box will ...
Definition BoundingBox.h:44