|
|
template<class T > |
| bool | celeritas::is_infinite (BoundingBox< T > const &bbox) |
| | Check if a bounding box spans (-inf, inf) in every direction.
|
| |
| template<class T > |
| bool | celeritas::is_finite (BoundingBox< T > const &bbox) |
| | Check if a bounding box has no infinities.
|
| |
| template<class T > |
| bool | celeritas::is_degenerate (BoundingBox< T > const &bbox) |
| | Check if a bounding box has zero length in any direction.
|
| |
|
template<class T > |
| bool | celeritas::is_half_inf (BoundingBox< T > const &bbox) |
| | Whether any axis has an infinity on one bound but not the other.
|
| |
| template<class T > |
| Array< T, 3 > | celeritas::calc_center (BoundingBox< T > const &bbox) |
| | Calculate the center of a bounding box.
|
| |
| template<class T > |
| Array< T, 3 > | celeritas::calc_half_widths (BoundingBox< T > const &bbox) |
| | Calculate the half widths of the bounding box.
|
| |
| template<class T > |
| T | celeritas::calc_surface_area (BoundingBox< T > const &bbox) |
| | Calculate the surface area of a bounding box.
|
| |
| template<class T > |
| T | celeritas::calc_volume (BoundingBox< T > const &bbox) |
| | Calculate the volume of a bounding box.
|
| |
|
template<class T > |
| constexpr BoundingBox< T > | celeritas::calc_union (BoundingBox< T > const &a, BoundingBox< T > const &b) |
| | Calculate the smallest bounding box enclosing two bounding boxes.
|
| |
| template<class T > |
| constexpr BoundingBox< T > | celeritas::calc_intersection (BoundingBox< T > const &a, BoundingBox< T > const &b) |
| | Calculate the intersection of two bounding boxes.
|
| |
| template<class T > |
| bool | celeritas::encloses (BoundingBox< T > const &big, BoundingBox< T > const &small) |
| | Check if all points inside the small bbox are in the big bbox.
|
| |
| template<class T > |
| bool | celeritas::intersects_segment (BoundingBox< T > const &bbox, Array< T, 3 > const &pos, Array< T, 3 > const &dir, T distance) |
| | Check if a segment from pos in direction dir of length distance intersects the bounding box.
|
| |
|
BBox | celeritas::calc_transform (Translation const &tr, BBox const &a) |
| | Calculate the bounding box of a translated box.
|
| |
| BBox | celeritas::calc_transform (Transformation const &tr, BBox const &a) |
| | Calculate the axis-aligned bounding box of a transformed box.
|
| |
Utilities for bounding boxes.
Calculate the axis-aligned bounding box of a transformed box.
Transforming a box usually results in an oriented bounding box, but sometimes that OBB is also an AABB. This function implicitly creates the transformed bounding box and creates an AABB that encompasses that box.
The result returns an exactly transformed bounding box for axis-aligned rotations. To achieve exactness for semi-infinite bounding boxes, this method has a custom implementation of GEMV for applying exact rotations if the matrix representation simply switches vector entries or flips their sign. Without the complication, floating point arithmetic results in NaN from multiplying zeroes (in the matrix) by the infinite values.
Check if a segment from pos in direction dir of length distance intersects the bounding box.
If the position is already inside the bounding box, the result is always true. This uses a separating-axis test (see ericson-collision-2004 ). It translates the coordinate system to the center of the bbox and tests six axes (see Fig. 5.23, Table 5.1 in reference):
- The AABB face normals
- The cross products between the direction vector and face normals
Note the manual unrolling of the off-axis test leads to a 10% speedup in the along-step kernel.
- Warning
- Infinite segment lengths are allowed to support degenerate cases, but they will result in false positives and a slowdown.
- Note
- Infinite bounding boxes are not supported, but they should never be generated due to the construction implementation.