Jet
v1.3.3
|
Generic N-D axis-aligned bounding box class. More...
#include <jet/bounding_box.h>
Public Types | |
typedef Vector< T, N > | VectorType |
Public Member Functions | |
BoundingBox () | |
Default constructor. More... | |
BoundingBox (const VectorType &point1, const VectorType &point2) | |
Constructs a box that tightly covers two points. More... | |
BoundingBox (const BoundingBox &other) | |
Constructs a box with other box instance. More... | |
bool | overlaps (const BoundingBox &other) const |
Returns true of this box and other box overlaps. More... | |
bool | contains (const VectorType &point) const |
Returns true if the input point is inside of this box. More... | |
VectorType | midPoint () const |
Returns the mid-point of this box. More... | |
T | diagonalLength () const |
Returns diagonal length of this box. More... | |
T | diagonalLengthSquared () const |
Returns squared diagonal length of this box. More... | |
void | reset () |
Resets this box to initial state (min=infinite, max=-infinite). More... | |
void | merge (const VectorType &point) |
Merges this and other point. More... | |
void | merge (const BoundingBox &other) |
Merges this and other boxes. More... | |
void | expand (T delta) |
Public Attributes | |
VectorType | lowerCorner |
Lower corner of the bounding box. More... | |
VectorType | upperCorner |
Upper corner of the bounding box. More... | |
Generic N-D axis-aligned bounding box class.
T | - Real number type. |
N | - Dimension. |
typedef Vector<T, N> jet::BoundingBox< T, N >::VectorType |
jet::BoundingBox< T, N >::BoundingBox | ( | ) |
Default constructor.
jet::BoundingBox< T, N >::BoundingBox | ( | const VectorType & | point1, |
const VectorType & | point2 | ||
) |
Constructs a box that tightly covers two points.
jet::BoundingBox< T, N >::BoundingBox | ( | const BoundingBox< T, N > & | other | ) |
Constructs a box with other box instance.
bool jet::BoundingBox< T, N >::contains | ( | const VectorType & | point | ) | const |
Returns true if the input point is inside of this box.
T jet::BoundingBox< T, N >::diagonalLength | ( | ) | const |
Returns diagonal length of this box.
T jet::BoundingBox< T, N >::diagonalLengthSquared | ( | ) | const |
Returns squared diagonal length of this box.
void jet::BoundingBox< T, N >::expand | ( | T | delta | ) |
Expands this box by given delta to all direction. If the width of the box was x, expand(y) will result a box with x+y+y width.
void jet::BoundingBox< T, N >::merge | ( | const BoundingBox< T, N > & | other | ) |
Merges this and other boxes.
void jet::BoundingBox< T, N >::merge | ( | const VectorType & | point | ) |
Merges this and other point.
VectorType jet::BoundingBox< T, N >::midPoint | ( | ) | const |
Returns the mid-point of this box.
bool jet::BoundingBox< T, N >::overlaps | ( | const BoundingBox< T, N > & | other | ) | const |
Returns true of this box and other box overlaps.
void jet::BoundingBox< T, N >::reset | ( | ) |
Resets this box to initial state (min=infinite, max=-infinite).
VectorType jet::BoundingBox< T, N >::lowerCorner |
Lower corner of the bounding box.
VectorType jet::BoundingBox< T, N >::upperCorner |
Upper corner of the bounding box.