template<class T, std::size_t N>
BoundingBox struct

A simple bounding box.

Template parameters
T the type of point (must be a real floating point type)
N the dimension of the point (must be greater than zero)

Public types

using Point = Eigen::Matrix<T, N, 1>

Constructors, destructors, conversion operators

BoundingBox(const Point& min, const Point& max)
BoundingBox(const Point&& min, const Point&& max)

Public functions

auto hyperSphereIntersection(const Point& p, const T& radius) const -> bool

Public variables

Point min
Point max

Typedef documentation

template<class T, std::size_t N>
typedef Eigen::Matrix<T, N, 1> BoundingBox<T, N>::Point

Alias for the internal point structure

Function documentation

template<class T, std::size_t N>
BoundingBox<T, N>::BoundingBox(const Point& min, const Point& max)

Parameters
min the lower end of the bounding box
max the upper end of the bounding box

Constructor of the bounding box

template<class T, std::size_t N>
BoundingBox<T, N>::BoundingBox(const Point&& min, const Point&& max)

Parameters
min the lower end of the bounding box
max the upper end of the bounding box

rvalue constructor of the bounding box

template<class T, std::size_t N>
bool BoundingBox<T, N>::hyperSphereIntersection(const Point& p, const T& radius) const

Parameters
p the center of the hypersphere
radius the radius of the hypersphere

Check if an hypersphere intersects the bounding box. The algorithm is an adaptation in N dimension of the method proposed by e.James from https://stackoverflow.com/questions/401847/circle-rectangle-collision-detection-intersection. The algorithm restricts checks within one corner of the bounding box.

Variable documentation

template<class T, std::size_t N>
Point BoundingBox<T, N>::min

The lower end of the bounding box

template<class T, std::size_t N>
Point BoundingBox<T, N>::max

The upper end of the bounding box