|
ACTS
Experiment-independent tracking
|
Implementation of an Axis Aligned Bounding Box. More...
#include <Acts/Utilities/BoundingBox.hpp>
Public Types | |
| using | entity_type = entity_t |
| Type of stored entity. | |
| using | Size = NamedType<VertexType, struct SizeParameter> |
| Strong type to select the correct constructor. | |
| using | transform_type = Eigen::Transform<value_type, DIM, Eigen::Affine> |
| The transform type based on the value_type. | |
| using | value_type = value_t |
| The value type used by this class. | |
| using | vertex_array_type = Eigen::Array<value_t, DIM, 1> |
| Associated array value to VertexType. | |
| using | VertexType = Eigen::Matrix<value_t, DIM, 1> |
| Re-export vertex type based on value type given. | |
Public Member Functions | |
| AxisAlignedBoundingBox (const entity_t *entity, const VertexType ¢er, const Size &size) | |
| Constructor from a center position, and a width and height. | |
| AxisAlignedBoundingBox (const entity_t *entity, const VertexType &vmin, const VertexType &vmax) | |
| Constructor from an entity pointer, and the min and max vertices. | |
| AxisAlignedBoundingBox (const self_t &other)=default | |
| Copy constructor from other bounding box. | |
| AxisAlignedBoundingBox (const std::vector< self_t * > &boxes, vertex_array_type envelope=vertex_array_type::Zero()) | |
| Constructor from a list of child boxes. | |
| const VertexType & | center () const |
| Get the center position of this bounding box. | |
| void | draw (IVisualization3D &helper, Color color={120, 120, 120}, const transform_type &trf=transform_type::Identity()) const |
| Draw this bounding box using the given visualization helper. | |
| const entity_t * | entity () const |
| Return the entity associated with this box. | |
| const self_t * | getLeftChild () const |
| Get the left child (i.e. | |
| const self_t * | getSkip () const |
| Get the skip node for this box. | |
| bool | hasEntity () const |
| Check whether this node as an associated entity. | |
| template<std::size_t sides> | |
| bool | intersect (const Frustum< value_type, DIM, sides > &fr) const |
| Check if a frustum intersects with this bounding box. | |
| bool | intersect (const Ray< value_type, DIM > &ray) const |
| Implements the slab method for Ray/AABB intersections. | |
| bool | intersect (const VertexType &point) const |
| Calculate whether a point is inside this box. | |
| const VertexType & | max () const |
| Get the maximum vertex. | |
| const VertexType & | min () const |
| Get the minimum vertex. | |
| AxisAlignedBoundingBox & | operator= (const self_t &other)=default |
| Copy assignment operator from other bounding box. | |
| void | setEntity (const entity_t *entity) |
| Set the entity associated with with this box. | |
| void | setSkip (self_t *skip) |
| Set the skip node (bounding box). | |
| std::ostream & | svg (std::ostream &os, value_type w, value_type h, value_type unit=10, const std::string &label="", const std::string &fillcolor="grey") const |
| Draw this bounding box as SVG. | |
| std::ostream & | toStream (std::ostream &os) const |
| Write information about this bounding box to a stream. | |
| void | transform (const transform_type &trf) |
| Transforms this bounding box using the given transform. | |
| self_t | transformed (const transform_type &trf) const |
| Transforms this bounding box using the given transform. | |
Static Public Member Functions | |
| static std::pair< VertexType, VertexType > | wrap (const std::vector< const self_t * > &boxes, vertex_array_type envelope=vertex_array_type::Zero()) |
Helper function to calculate the size of a bounding box enclosing boxes. | |
| static std::pair< VertexType, VertexType > | wrap (const std::vector< self_t * > &boxes, vertex_array_type envelope=vertex_array_type::Zero()) |
Helper function to calculate the size of a bounding box enclosing boxes. | |
| static std::pair< VertexType, VertexType > | wrap (const std::vector< self_t > &boxes, vertex_array_type envelope=vertex_array_type::Zero()) |
Helper function to calculate the size of a bounding box enclosing boxes. | |
Static Public Attributes | |
| static const std::size_t | dim = DIM |
| Re-export dimension from template parameter. | |
Implementation of an Axis Aligned Bounding Box.
This type is compatible with 2D and 3D boxes
| using Acts::AxisAlignedBoundingBox< entity_t, value_t, DIM >::entity_type = entity_t |
Type of stored entity.
| using Acts::AxisAlignedBoundingBox< entity_t, value_t, DIM >::Size = NamedType<VertexType, struct SizeParameter> |
Strong type to select the correct constructor.
| using Acts::AxisAlignedBoundingBox< entity_t, value_t, DIM >::transform_type = Eigen::Transform<value_type, DIM, Eigen::Affine> |
The transform type based on the value_type.
| using Acts::AxisAlignedBoundingBox< entity_t, value_t, DIM >::value_type = value_t |
The value type used by this class.
| using Acts::AxisAlignedBoundingBox< entity_t, value_t, DIM >::vertex_array_type = Eigen::Array<value_t, DIM, 1> |
Associated array value to VertexType.
| using Acts::AxisAlignedBoundingBox< entity_t, value_t, DIM >::VertexType = Eigen::Matrix<value_t, DIM, 1> |
Re-export vertex type based on value type given.
|
default |
Copy constructor from other bounding box.
| other | The other bounding box to copy from |
| Acts::AxisAlignedBoundingBox< entity_t, value_t, DIM >::AxisAlignedBoundingBox | ( | const entity_t * | entity, |
| const VertexType & | vmin, | ||
| const VertexType & | vmax ) |
Constructor from an entity pointer, and the min and max vertices.
| entity | The entity to store |
| vmin | The minimum vertex. |
| vmax | The maximum vertex. |
| Acts::AxisAlignedBoundingBox< entity_t, value_t, DIM >::AxisAlignedBoundingBox | ( | const entity_t * | entity, |
| const VertexType & | center, | ||
| const Size & | size ) |
Constructor from a center position, and a width and height.
| entity | The entity to store |
| center | The center position |
| size | The size (width and height) of the box. |
size is required to disambiguate this constructor from the other one above. It is a wrapper around a simple Vector3.
|
explicit |
Constructor from a list of child boxes.
This box will wrap around all boxes contained in boxes, and additional envelope can be given.
| boxes | Vector of child boxes to store in this bounding box. |
| envelope | Envelope that will be added/subtracted to the dimension. |
| const VertexType & Acts::AxisAlignedBoundingBox< entity_t, value_t, DIM >::center | ( | ) | const |
Get the center position of this bounding box.
| void Acts::AxisAlignedBoundingBox< entity_t, value_t, DIM >::draw | ( | IVisualization3D & | helper, |
| Color | color = {120, 120, 120}, | ||
| const transform_type & | trf = transform_type::Identity() ) const |
Draw this bounding box using the given visualization helper.
This method is only available for the 3D case.
| helper | The visualization helper to write to |
| color | The color to use for drawing |
| trf | An optional transform to apply first. |
| const entity_t * Acts::AxisAlignedBoundingBox< entity_t, value_t, DIM >::entity | ( | ) | const |
Return the entity associated with this box.
This might be nullptr if there is no entity attached.
| const self_t * Acts::AxisAlignedBoundingBox< entity_t, value_t, DIM >::getLeftChild | ( | ) | const |
Get the left child (i.e.
the first of the children that are inside this bounding box).
| const self_t * Acts::AxisAlignedBoundingBox< entity_t, value_t, DIM >::getSkip | ( | ) | const |
Get the skip node for this box.
| bool Acts::AxisAlignedBoundingBox< entity_t, value_t, DIM >::hasEntity | ( | ) | const |
Check whether this node as an associated entity.
If it does not have one, this is a purely abstract container box.
| bool Acts::AxisAlignedBoundingBox< entity_t, value_t, DIM >::intersect | ( | const Frustum< value_type, DIM, sides > & | fr | ) | const |
Check if a frustum intersects with this bounding box.
This method implements an algorithm similar to the one described in "Optimized View Frustum Culling Algorithms for Bounding Boxes (2012)" [2] (https://doi.org/10.1080/10867651.2000.10487517), but drops some of the more sophisticated optimization.
| fr | The frustum |
| bool Acts::AxisAlignedBoundingBox< entity_t, value_t, DIM >::intersect | ( | const Ray< value_type, DIM > & | ray | ) | const |
Implements the slab method for Ray/AABB intersections.
See https://tavianator.com/fast-branchless-raybounding-box-intersections/, https://tavianator.com/fast-branchless-raybounding-box-intersections-part-2-nans/, https://medium.com/@bromanz/another-view-on-the-classic-ray-aabb-intersection-algorithm-for-bvh-traversal-41125138b525 The original algorithms is described in "Graphics Gems (1990)" [1] (https://doi.org/10.1016/B978-0-08-050753-8.50084-X)
NaNs are handled by Eigen. See https://eigen.tuxfamily.org/bz/show_bug.cgi?id=564 | ray | The ray to intersect with |
| bool Acts::AxisAlignedBoundingBox< entity_t, value_t, DIM >::intersect | ( | const VertexType & | point | ) | const |
Calculate whether a point is inside this box.
| point | The point to test. |
| const VertexType & Acts::AxisAlignedBoundingBox< entity_t, value_t, DIM >::max | ( | ) | const |
Get the maximum vertex.
| const VertexType & Acts::AxisAlignedBoundingBox< entity_t, value_t, DIM >::min | ( | ) | const |
Get the minimum vertex.
|
default |
Copy assignment operator from other bounding box.
| other | The other AABB |
| void Acts::AxisAlignedBoundingBox< entity_t, value_t, DIM >::setEntity | ( | const entity_t * | entity | ) |
Set the entity associated with with this box.
| entity | The entity |
| void Acts::AxisAlignedBoundingBox< entity_t, value_t, DIM >::setSkip | ( | self_t * | skip | ) |
Set the skip node (bounding box).
| skip | The target skip node pointer |
| std::ostream & Acts::AxisAlignedBoundingBox< entity_t, value_t, DIM >::svg | ( | std::ostream & | os, |
| value_type | w, | ||
| value_type | h, | ||
| value_type | unit = 10, | ||
| const std::string & | label = "", | ||
| const std::string & | fillcolor = "grey" ) const |
Draw this bounding box as SVG.
This method is only available for the 2D case.
| os | The output stream to write to |
| w | The width of the output SVG. |
| h | The height of the output SVG. |
| unit | A scale factor to apply before drawing |
| label | A label to put next to the box. |
| fillcolor | Color to fill the box with. |
os. | std::ostream & Acts::AxisAlignedBoundingBox< entity_t, value_t, DIM >::toStream | ( | std::ostream & | os | ) | const |
Write information about this bounding box to a stream.
| os | The output stream. |
| void Acts::AxisAlignedBoundingBox< entity_t, value_t, DIM >::transform | ( | const transform_type & | trf | ) |
Transforms this bounding box using the given transform.
This method modifies the box it is called on.
| trf | The transform |
| self_t Acts::AxisAlignedBoundingBox< entity_t, value_t, DIM >::transformed | ( | const transform_type & | trf | ) | const |
Transforms this bounding box using the given transform.
This method returns a copy of this box, with the transformation applied, and leaves this instance unchanged.
| trf | The transform |
|
static |
Helper function to calculate the size of a bounding box enclosing boxes.
| boxes | The boxes to wrap (const pointers) |
| envelope | Optional envelop to add/subtract to dimension. |
|
static |
Helper function to calculate the size of a bounding box enclosing boxes.
Overload which accepts non-const boxes in boxes.
| boxes | The boxes to wrap (non-const pointers) |
| envelope | Optional envelop to add/subtract to dimension. |
|
static |
Helper function to calculate the size of a bounding box enclosing boxes.
Overload which accepts a vector in boxes which owns the instances
| boxes | The boxes to wrap (by-value vector) |
| envelope | Optional envelop to add/subtract to dimension. |
|
static |
Re-export dimension from template parameter.