26bool inBox(
const std::array<T, 3> &position,
const std::array<T, 3> &low,
const std::array<T, 3> &high) {
27 static_assert(std::is_floating_point<T>::value,
"inBox assumes floating point types");
30 for (
int d = 0; d < 3; ++d) {
31 const bool isLargerThanLower = position[d] >= low[d];
32 const bool isSmallerThanHigher = position[d] < high[d];
33 inBox =
inBox and isLargerThanLower and isSmallerThanHigher;
50bool notInBox(
const std::array<T, 3> &position,
const std::array<T, 3> &low,
const std::array<T, 3> &high) {
51 return not(
inBox(position, low, high));
67bool boxesOverlap(
const std::array<T, 3> &boxALow,
const std::array<T, 3> &boxAHigh,
const std::array<T, 3> &boxBLow,
68 const std::array<T, 3> &boxBHigh) {
69 static_assert(std::is_floating_point_v<T>,
"boxesOverlap assumes floating point types");
71 auto overlap1D = [&](
size_t dim) {
return boxAHigh[dim] > boxBLow[dim] and boxBHigh[dim] > boxALow[dim]; };
73 return overlap1D(0) and overlap1D(1) and overlap1D(2);
In this namespace some helper classes and functions can be found used inside of AutoPas.
Definition: namespaces.h:44
bool boxesOverlap(const std::array< T, 3 > &boxALow, const std::array< T, 3 > &boxAHigh, const std::array< T, 3 > &boxBLow, const std::array< T, 3 > &boxBHigh)
Checks if two boxes have overlap.
Definition: inBox.h:67
bool notInBox(const std::array< T, 3 > &position, const std::array< T, 3 > &low, const std::array< T, 3 > &high)
Checks if position is not inside of a box defined by low and high.
Definition: inBox.h:50
bool inBox(const std::array< T, 3 > &position, const std::array< T, 3 > &low, const std::array< T, 3 > &high)
Checks if position is inside of a box defined by low and high.
Definition: inBox.h:26