Axis-aligned bounding box (min/max in the same space).
More...
#include <kdatatype.h>
|
| | kAABB ()=default |
| | Constructs an empty (invalid) bounding box.
|
| | kAABB (kVec3 min, kVec3 max) |
| | Constructs a bounding box from explicit corners.
|
| kVec3 | center () const |
| | Returns the geometric centre of the box.
|
| kVec3 | halfExtents () const |
| | Returns half the size of the box along each axis.
|
| bool | isValid () const |
| | Returns true if min is component-wise less than or equal to max (i.e. the box is non-degenerate).
|
| void | expandBy (const kVec3 &point) |
| | Grows the box so that it encloses the given point.
|
| void | merge (const kAABB &other) |
| | Grows the box so that it encloses another box.
|
| kAABB | expanded (float amount) const |
| | Returns a copy of the box uniformly expanded outward by the given amount on every side.
|
| bool | contains (const kAABB &other) const |
| | Tests whether this box fully contains another box.
|
| bool | overlaps (const kAABB &other) const |
| | Tests whether this box intersects another box.
|
|
| kVec3 | min = kVec3( 1e30f) |
| | Minimum corner; initialised to +inf so the box starts empty/invalid.
|
| kVec3 | max = kVec3(-1e30f) |
| | Maximum corner; initialised to -inf so the box starts empty/invalid.
|
Axis-aligned bounding box (min/max in the same space).
◆ kAABB() [1/2]
Constructs an empty (invalid) bounding box.
◆ kAABB() [2/2]
Constructs a bounding box from explicit corners.
- Parameters
-
| min | Minimum corner. |
| max | Maximum corner. |
◆ center()
| kVec3 kemena::kAABB::center |
( |
| ) |
const |
|
inline |
Returns the geometric centre of the box.
◆ contains()
| bool kemena::kAABB::contains |
( |
const kAABB & | other | ) |
const |
|
inline |
Tests whether this box fully contains another box.
- Parameters
-
| other | Box to test for containment. |
- Returns
- true if
other lies entirely within this box.
◆ expandBy()
| void kemena::kAABB::expandBy |
( |
const kVec3 & | point | ) |
|
|
inline |
Grows the box so that it encloses the given point.
- Parameters
-
◆ expanded()
| kAABB kemena::kAABB::expanded |
( |
float | amount | ) |
const |
|
inline |
Returns a copy of the box uniformly expanded outward by the given amount on every side.
- Parameters
-
| amount | Distance to push each face outward. |
- Returns
- Expanded bounding box.
◆ halfExtents()
| kVec3 kemena::kAABB::halfExtents |
( |
| ) |
const |
|
inline |
Returns half the size of the box along each axis.
◆ isValid()
| bool kemena::kAABB::isValid |
( |
| ) |
const |
|
inline |
Returns true if min is component-wise less than or equal to max (i.e. the box is non-degenerate).
◆ merge()
| void kemena::kAABB::merge |
( |
const kAABB & | other | ) |
|
|
inline |
Grows the box so that it encloses another box.
- Parameters
-
| other | Box to merge into this one. |
◆ overlaps()
| bool kemena::kAABB::overlaps |
( |
const kAABB & | other | ) |
const |
|
inline |
Tests whether this box intersects another box.
- Parameters
-
| other | Box to test against. |
- Returns
- true if the two boxes overlap (touching counts as overlap).
◆ max
Maximum corner; initialised to -inf so the box starts empty/invalid.
◆ min
Minimum corner; initialised to +inf so the box starts empty/invalid.
The documentation for this struct was generated from the following file: