|
EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
|
Axis-aligned bounding box (AABB) enclosing a set of 3D points. More...
#include <EBGeometry_BoundingVolumes.hpp>
Public Types | |
| using | Vec3 = Vec3T< T > |
| Alias to cut down on typing. | |
Public Member Functions | |
| AABBT () noexcept=default | |
| Default constructor. Sets lo = +∞, hi = −∞ (inverted sentinel). | |
| AABBT (const Vec3T< T > &a_lo, const Vec3T< T > &a_hi) noexcept | |
| Construct an AABB from explicit low and high corners. | |
| AABBT (const AABBT &a_other) noexcept | |
| Copy constructor. | |
| AABBT (const std::vector< AABBT< T > > &a_others) noexcept | |
Construct the smallest AABB enclosing all boxes in a_others. | |
| template<class P > | |
| AABBT (const std::vector< Vec3T< P > > &a_points) noexcept | |
| Construct the smallest AABB enclosing a set of 3D points. | |
| ~AABBT () noexcept | |
| Destructor. | |
| AABBT & | operator= (const AABBT< T > &a_other)=default |
| Copy assignment. | |
| AABBT (AABBT &&a_other) noexcept=default | |
| Move constructor. | |
| AABBT & | operator= (AABBT &&a_other) noexcept=default |
| Move assignment operator. | |
| template<class P > | |
| void | define (const std::vector< Vec3T< P > > &a_points) noexcept |
Fit this AABB to the smallest box enclosing a_points. | |
| bool | intersects (const AABBT &a_other) const noexcept |
Test whether this AABB intersects a_other. | |
| Vec3T< T > & | getLowCorner () noexcept |
| Get a modifiable reference to the low corner of the AABB. | |
| const Vec3T< T > & | getLowCorner () const noexcept |
| Get the low corner of the AABB. | |
| Vec3T< T > & | getHighCorner () noexcept |
| Get a modifiable reference to the high corner of the AABB. | |
| const Vec3T< T > & | getHighCorner () const noexcept |
| Get the high corner of the AABB. | |
| Vec3 | getCentroid () const noexcept |
| Compute the centroid of the AABB. | |
| T | getOverlappingVolume (const AABBT< T > &a_other) const noexcept |
Compute the overlapping volume between this AABB and a_other. | |
| T | getDistance (const Vec3 &a_x0) const noexcept |
Compute the unsigned distance from a_x0 to this AABB. | |
| T | getDistance2 (const Vec3 &a_x0) const noexcept |
Compute the squared unsigned distance from a_x0 to this AABB. | |
| T | getVolume () const noexcept |
| Compute the AABB volume. | |
| T | getArea () const noexcept |
| Compute the AABB surface area. | |
Protected Attributes | |
| Vec3 | m_loCorner = Vec3::infinity() |
| Low corner of the bounding box. Initialised to +∞ (inverted sentinel). | |
| Vec3 | m_hiCorner = -Vec3::infinity() |
| High corner of the bounding box. Initialised to −∞ (inverted sentinel). | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const AABBT< T > &aabb) |
| Output an AABB to a stream in the form "(lo, hi)". | |
Axis-aligned bounding box (AABB) enclosing a set of 3D points.
| T | Floating-point precision (e.g., float or double). |
|
defaultnoexcept |
Default constructor. Sets lo = +∞, hi = −∞ (inverted sentinel).
The inverted state is the identity element for AABB union and also ensures that any geometric query (distance, volume, intersection) fires an EBGEOMETRY_EXPECT assertion. Call define() or use the explicit constructor before use.
|
inlinenoexcept |
Construct an AABB from explicit low and high corners.
| [in] | a_lo | Low corner. |
| [in] | a_hi | High corner. |
|
inlinenoexcept |
Copy constructor.
| [in] | a_other | Bounding box to copy. |
|
inlinenoexcept |
Construct the smallest AABB enclosing all boxes in a_others.
| [in] | a_others | Bounding boxes to enclose. |
|
inlinenoexcept |
Construct the smallest AABB enclosing a set of 3D points.
Mixed floating-point precision is allowed: P may differ from T.
| P | Floating-point precision of the input points. |
| [in] | a_points | Set of 3D points. |
|
defaultnoexcept |
Move constructor.
| [in] | a_other | Bounding box to move from. |
|
inlinenoexcept |
Fit this AABB to the smallest box enclosing a_points.
Mixed floating-point precision is allowed: P may differ from T.
| P | Floating-point precision of the input points. |
| [in] | a_points | Set of 3D points. |
|
inlinenoexcept |
Compute the AABB surface area.
|
inlinenoexcept |
Compute the centroid of the AABB.
|
inlinenoexcept |
Compute the unsigned distance from a_x0 to this AABB.
| [in] | a_x0 | 3D query point. |
a_x0 to the nearest box face; zero if a_x0 is inside.
|
inlinenoexcept |
Compute the squared unsigned distance from a_x0 to this AABB.
Avoids the sqrt that getDistance() pays – prefer this whenever the caller only needs the distance for comparison (e.g. BVH pruning), not its actual magnitude.
| [in] | a_x0 | 3D query point. |
a_x0 to the nearest box face; zero if a_x0 is inside.
|
inlinenoexcept |
Get the high corner of the AABB.
|
inlinenoexcept |
Get a modifiable reference to the high corner of the AABB.
|
inlinenoexcept |
Get the low corner of the AABB.
|
inlinenoexcept |
Get a modifiable reference to the low corner of the AABB.
|
inlinenoexcept |
Compute the overlapping volume between this AABB and a_other.
| [in] | a_other | The other AABB. |
|
inlinenoexcept |
Compute the AABB volume.
|
inlinenoexcept |
Test whether this AABB intersects a_other.
| [in] | a_other | The other AABB. |
|
defaultnoexcept |
Move assignment operator.
| [in] | a_other | Bounding box to move from. |
|
default |
Copy assignment.
| [in] | a_other | Bounding box to copy. |
Output an AABB to a stream in the form "(lo, hi)".
| [in,out] | os | Output stream. |
| [in] | aabb | Bounding box to print. |
os to allow chaining.