Jet
v1.3.3
|
3-D axis-aligned bounding box class. More...
#include <jet/bounding_box3.h>
Public Member Functions | |
BoundingBox () | |
Default constructor. More... | |
BoundingBox (const Vector3< T > &point1, const Vector3< T > &point2) | |
Constructs a box that tightly covers two points. More... | |
BoundingBox (const BoundingBox &other) | |
Constructs a box with other box instance. More... | |
T | width () const |
Returns width of the box. More... | |
T | height () const |
Returns height of the box. More... | |
T | depth () const |
Returns depth of the box. More... | |
T | length (size_t axis) |
Returns length of the box in given axis. More... | |
bool | overlaps (const BoundingBox &other) const |
Returns true of this box and other box overlaps. More... | |
bool | contains (const Vector3< T > &point) const |
Returns true if the input vector is inside of this box. More... | |
bool | intersects (const Ray3< T > &ray) const |
Returns true if the input ray is intersecting with this box. More... | |
BoundingBoxRayIntersection3< T > | closestIntersection (const Ray3< T > &ray) const |
Vector3< T > | 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 Vector3< T > &point) |
Merges this and other point. More... | |
void | merge (const BoundingBox &other) |
Merges this and other box. More... | |
void | expand (T delta) |
Vector3< T > | corner (size_t idx) const |
Returns corner position. Index starts from x-first order. More... | |
Vector3< T > | clamp (const Vector3< T > &point) const |
Returns the clamped point. More... | |
bool | isEmpty () const |
Returns true if the box is empty. More... | |
Public Attributes | |
Vector3< T > | lowerCorner |
Lower corner of the bounding box. More... | |
Vector3< T > | upperCorner |
Upper corner of the bounding box. More... | |
3-D axis-aligned bounding box class.
T | - Real number type. |
N | - Dimension. |
jet::BoundingBox< T, 3 >::BoundingBox | ( | ) |
Default constructor.
jet::BoundingBox< T, 3 >::BoundingBox | ( | const Vector3< T > & | point1, |
const Vector3< T > & | point2 | ||
) |
Constructs a box that tightly covers two points.
jet::BoundingBox< T, 3 >::BoundingBox | ( | const BoundingBox< T, 3 > & | other | ) |
Constructs a box with other box instance.
Vector3<T> jet::BoundingBox< T, 3 >::clamp | ( | const Vector3< T > & | point | ) | const |
Returns the clamped point.
BoundingBoxRayIntersection3<T> jet::BoundingBox< T, 3 >::closestIntersection | ( | const Ray3< T > & | ray | ) | const |
Returns intersection.isIntersecting = true if the input ray is intersecting with this box. If interesects, intersection.tNear is assigned with distant to the closest intersecting point, and intersection.tFar with furthest.
bool jet::BoundingBox< T, 3 >::contains | ( | const Vector3< T > & | point | ) | const |
Returns true if the input vector is inside of this box.
Vector3<T> jet::BoundingBox< T, 3 >::corner | ( | size_t | idx | ) | const |
Returns corner position. Index starts from x-first order.
T jet::BoundingBox< T, 3 >::depth | ( | ) | const |
Returns depth of the box.
T jet::BoundingBox< T, 3 >::diagonalLength | ( | ) | const |
Returns diagonal length of this box.
T jet::BoundingBox< T, 3 >::diagonalLengthSquared | ( | ) | const |
Returns squared diagonal length of this box.
void jet::BoundingBox< T, 3 >::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.
T jet::BoundingBox< T, 3 >::height | ( | ) | const |
Returns height of the box.
bool jet::BoundingBox< T, 3 >::intersects | ( | const Ray3< T > & | ray | ) | const |
Returns true if the input ray is intersecting with this box.
bool jet::BoundingBox< T, 3 >::isEmpty | ( | ) | const |
Returns true if the box is empty.
T jet::BoundingBox< T, 3 >::length | ( | size_t | axis | ) |
Returns length of the box in given axis.
void jet::BoundingBox< T, 3 >::merge | ( | const BoundingBox< T, 3 > & | other | ) |
Merges this and other box.
void jet::BoundingBox< T, 3 >::merge | ( | const Vector3< T > & | point | ) |
Merges this and other point.
Vector3<T> jet::BoundingBox< T, 3 >::midPoint | ( | ) | const |
Returns the mid-point of this box.
bool jet::BoundingBox< T, 3 >::overlaps | ( | const BoundingBox< T, 3 > & | other | ) | const |
Returns true of this box and other box overlaps.
void jet::BoundingBox< T, 3 >::reset | ( | ) |
Resets this box to initial state (min=infinite, max=-infinite).
T jet::BoundingBox< T, 3 >::width | ( | ) | const |
Returns width of the box.
Vector3<T> jet::BoundingBox< T, 3 >::lowerCorner |
Lower corner of the bounding box.
Vector3<T> jet::BoundingBox< T, 3 >::upperCorner |
Upper corner of the bounding box.