ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
detray::axis_aligned_bounding_volume< shape_t, algebra_t > Class Template Reference

An axis aligned bounding box of a given. More...

#include <detray/utils/bounding_volume.hpp>

Inheritance diagram for detray::axis_aligned_bounding_volume< shape_t, algebra_t >:
[legend]

Public Member Functions

constexpr axis_aligned_bounding_volume ()=default
 Default constructor builds an infinite box.
template<typename mask_t, typename S = shape_t>
requires std::is_same_v<S, cuboid3D>
constexpr axis_aligned_bounding_volume (const mask_t &mask, std::size_t box_id, const scalar_t envelope)
 Construct around an arbitrary surface mask.
template<typename other_shape_t>
requires std::is_same_v< typename shape::template local_frame_type<algebra_t>, typename other_shape_t::template local_frame_type<algebra_t>>
constexpr axis_aligned_bounding_volume (const std::vector< axis_aligned_bounding_volume< other_shape_t, algebra_t > > &aabbs, std::size_t box_id, const scalar_t env)
 Construct a bounding box around a set of boxes.
 axis_aligned_bounding_volume (const std::vector< scalar_t > &values, std::size_t box_id)
 Construct from mask boundary vector.
template<typename... Args>
constexpr axis_aligned_bounding_volume (std::size_t box_id, Args &&... args)
 Constructor from mask boundary values.
constexpr auto bounds () const -> const mask< shape, algebra_t, std::size_t > &
 Return the shape mask storing this volume's bounds.
template<concepts::point3D point3_t>
constexpr auto center () const -> point3_t
template<concepts::transform3D transform3_t>
constexpr auto glob_max (const transform3_t &trf) const -> typename transform3_t::point3
 Transform the local maximum bounds into global Cartesian coordinates.
template<concepts::transform3D transform3_t>
constexpr auto glob_min (const transform3_t &trf) const -> typename transform3_t::point3
 Transform the local minimum bounds into global Cartesian coordinates.
constexpr auto id () const -> std::size_t
 Return the volume identifier.
constexpr bool intersect (const detail::ray< algebra_t > &ray, const scalar_t t=std::numeric_limits< scalar_t >::epsilon()) const
 Intersect the box with a ray.
template<concepts::point point_t>
constexpr bool is_inside (const point_t &loc_p, const scalar_t t=std::numeric_limits< scalar_t >::epsilon()) const
 Checks whether a point lies inside the box.
template<typename point_t>
constexpr auto loc_max () const -> point_t
template<typename point_t>
constexpr auto loc_min () const -> point_t
constexpr auto operator[] (const std::size_t i) const -> scalar_t
 Access one boundary value by its shape-specific index.
template<concepts::transform3D transform3_t, typename S = shape_t>
requires std::is_same_v<S, cuboid3D>
auto transform (const transform3_t &trf) const -> axis_aligned_bounding_volume
 Lower and upper point for minimum axis aligned bounding box of cuboid shape.
using scalar_t = dscalar<algebra_t>
 Define geometric propertiesScalar type used by the volume's mask.
using shape = shape_t
 Shape whose bounds are represented by this volume.
using boundaries = typename shape_t::boundaries
 Boundary enumeration for the represented shape.
template<typename A>
using local_frame = typename shape_t::template local_frame_type<A>
 Local frame type associated with the shape and algebra backend.
static constexpr std::size_t dim {shape_t::dim}
 Number of dimensions in the represented shape.

Detailed Description

template<typename shape_t, concepts::algebra algebra_t>
class detray::axis_aligned_bounding_volume< shape_t, algebra_t >

An axis aligned bounding box of a given.

Template Parameters
shape_t

Constructor & Destructor Documentation

◆ axis_aligned_bounding_volume() [1/4]

template<typename shape_t, concepts::algebra algebra_t>
template<typename... Args>
detray::axis_aligned_bounding_volume< shape_t, algebra_t >::axis_aligned_bounding_volume ( std::size_t box_id,
Args &&... args )
explicitconstexpr

Constructor from mask boundary values.

Parameters
box_idIdentifier associated with the volume.
argsShape boundary values forwarded to the mask constructor.

◆ axis_aligned_bounding_volume() [2/4]

template<typename shape_t, concepts::algebra algebra_t>
template<typename mask_t, typename S = shape_t>
requires std::is_same_v<S, cuboid3D>
detray::axis_aligned_bounding_volume< shape_t, algebra_t >::axis_aligned_bounding_volume ( const mask_t & mask,
std::size_t box_id,
const scalar_t envelope )
constexpr

Construct around an arbitrary surface mask.

Parameters
maskSurface mask whose local bounds define this volume.
box_idIdentifier associated with the volume.
envelopeExpansion applied to the surface bounds.

◆ axis_aligned_bounding_volume() [3/4]

template<typename shape_t, concepts::algebra algebra_t>
detray::axis_aligned_bounding_volume< shape_t, algebra_t >::axis_aligned_bounding_volume ( const std::vector< scalar_t > & values,
std::size_t box_id )

Construct from mask boundary vector.

Parameters
valuesBoundary values expected by the shape mask.
box_idIdentifier associated with the volume.

◆ axis_aligned_bounding_volume() [4/4]

template<typename shape_t, concepts::algebra algebra_t>
template<typename other_shape_t>
requires std::is_same_v< typename shape::template local_frame_type<algebra_t>, typename other_shape_t::template local_frame_type<algebra_t>>
detray::axis_aligned_bounding_volume< shape_t, algebra_t >::axis_aligned_bounding_volume ( const std::vector< axis_aligned_bounding_volume< other_shape_t, algebra_t > > & aabbs,
std::size_t box_id,
const scalar_t env )
constexpr

Construct a bounding box around a set of boxes.

Note
The input volumes must use the same local coordinate system.
Parameters
aabbsVolumes to enclose.
box_idIdentifier associated with the enclosing volume.
envMargin added to the enclosing bounds.

Member Function Documentation

◆ bounds()

template<typename shape_t, concepts::algebra algebra_t>
auto detray::axis_aligned_bounding_volume< shape_t, algebra_t >::bounds ( ) const->constmask< shape, algebra_t, std::size_t > &
constexpr

Return the shape mask storing this volume's bounds.

Returns
the bounds of the box, depending on its shape

◆ center()

template<typename shape_t, concepts::algebra algebra_t>
template<concepts::point3D point3_t>
auto detray::axis_aligned_bounding_volume< shape_t, algebra_t >::center ( ) const->point3_t
constexpr
Returns
the geometric center position in global cartesian system

◆ glob_max()

template<typename shape_t, concepts::algebra algebra_t>
template<concepts::transform3D transform3_t>
auto detray::axis_aligned_bounding_volume< shape_t, algebra_t >::glob_max ( const transform3_t & trf) const->typenametransform3_t::point3
constexpr

Transform the local maximum bounds into global Cartesian coordinates.

Parameters
trfTransform from the volume's local frame to global coordinates.
Returns
the maximum bounds of the volume in global cartesian coordinates

◆ glob_min()

template<typename shape_t, concepts::algebra algebra_t>
template<concepts::transform3D transform3_t>
auto detray::axis_aligned_bounding_volume< shape_t, algebra_t >::glob_min ( const transform3_t & trf) const->typenametransform3_t::point3
constexpr

Transform the local minimum bounds into global Cartesian coordinates.

Parameters
trfTransform from the volume's local frame to global coordinates.
Returns
the minimum bounds of the volume in global cartesian coordinates

◆ id()

template<typename shape_t, concepts::algebra algebra_t>
auto detray::axis_aligned_bounding_volume< shape_t, algebra_t >::id ( ) const->std::size_t
constexpr

Return the volume identifier.

Returns
the bounds of the box, depending on its shape

◆ intersect()

template<typename shape_t, concepts::algebra algebra_t>
bool detray::axis_aligned_bounding_volume< shape_t, algebra_t >::intersect ( const detail::ray< algebra_t > & ray,
const scalar_t t = std::numeric_limits<scalar_t>::epsilon() ) const
constexpr

Intersect the box with a ray.

Parameters
rayRay expressed in the volume's coordinate frame.
tTolerance used by the intersection test.
Returns
Whether the ray intersects the box.

◆ is_inside()

template<typename shape_t, concepts::algebra algebra_t>
template<concepts::point point_t>
bool detray::axis_aligned_bounding_volume< shape_t, algebra_t >::is_inside ( const point_t & loc_p,
const scalar_t t = std::numeric_limits<scalar_t>::epsilon() ) const
constexpr

Checks whether a point lies inside the box.

The point has to be defined in the coordinate frame that is spanned by the box axes.

Parameters
loc_pPoint in the volume's local coordinate frame.
tTolerance used by the mask containment check.
Returns
Whether the point lies inside the volume.

◆ loc_max()

template<typename shape_t, concepts::algebra algebra_t>
template<typename point_t>
auto detray::axis_aligned_bounding_volume< shape_t, algebra_t >::loc_max ( ) const->point_t
constexpr
Returns
the maximum bounds of the volume in local coordinates

◆ loc_min()

template<typename shape_t, concepts::algebra algebra_t>
template<typename point_t>
auto detray::axis_aligned_bounding_volume< shape_t, algebra_t >::loc_min ( ) const->point_t
constexpr
Returns
the minimum bounds of the volume in local coordinates

◆ operator[]()

template<typename shape_t, concepts::algebra algebra_t>
auto detray::axis_aligned_bounding_volume< shape_t, algebra_t >::operator[] ( const std::size_t i) const->scalar_t
constexpr

Access one boundary value by its shape-specific index.

Parameters
iIndex of the requested boundary.
Returns
The boundary value.

◆ transform()

template<typename shape_t, concepts::algebra algebra_t>
template<concepts::transform3D transform3_t, typename S = shape_t>
requires std::is_same_v<S, cuboid3D>
auto detray::axis_aligned_bounding_volume< shape_t, algebra_t >::transform ( const transform3_t & trf) const->axis_aligned_bounding_volume

Lower and upper point for minimum axis aligned bounding box of cuboid shape.

Computes the min and max vertices in global coordinates from the local minimum aabb. The global aabb is not necessarily an minimum aabb.

Parameters
trfaffine transformation
Returns
a new, transformed aabb.