11 #ifndef CUBBYFLOW_BOUNDING_BOX_HPP 12 #define CUBBYFLOW_BOUNDING_BOX_HPP 33 T
near = std::numeric_limits<T>::max();
36 T
far = std::numeric_limits<T>::max();
45 template <
typename T,
size_t N>
49 static_assert(N > 0,
"Dimension should be greater than 0");
51 std::is_floating_point<T>::value,
52 "BoundingBox only can be instantiated with floating point types");
79 [[nodiscard]] T Width()
const;
82 template <
typename U = T>
83 [[nodiscard]] std::enable_if_t<(N > 1), U> Height()
const;
86 template <
typename U = T>
87 [[nodiscard]] std::enable_if_t<(N > 2), U> Depth()
const;
90 [[nodiscard]] T Length(
size_t axis);
93 [[nodiscard]]
bool Overlaps(
const BoundingBox& other)
const;
96 [[nodiscard]]
bool Contains(
const VectorType& point)
const;
99 [[nodiscard]]
bool Intersects(
const RayType& ray)
const;
112 [[nodiscard]] T DiagonalLength()
const;
115 [[nodiscard]] T DiagonalLengthSquared()
const;
129 void Expand(T delta);
132 [[nodiscard]]
VectorType Corner(
size_t idx)
const;
138 [[nodiscard]]
bool IsEmpty()
const;
141 template <
typename U>
151 template <
typename T>
154 template <
typename T>
VectorType upperCorner
Upper corner of the bounding box.
Definition: BoundingBox.hpp:148
Class for N-D ray.
Definition: Ray.hpp:25
std::enable_if_t< std::is_arithmetic< T >::value, T > Clamp(T val, T low, T high)
Returns the clamped value.
Definition: MathUtils-Impl.hpp:166
T near
Distance to the first intersection point.
Definition: BoundingBox.hpp:33
N-D axis-aligned bounding box class.
Definition: BoundingBox.hpp:46
bool isIntersecting
True if the box and ray intersects.
Definition: BoundingBox.hpp:30
Definition: Matrix.hpp:27
Definition: pybind11Utils.hpp:20
void Merge(RandomIterator a, size_t size, RandomIterator2 temp, CompareFunction compareFunction)
Definition: Parallel-Impl.hpp:107
T far
Distance to the second (and the last) intersection point.
Definition: BoundingBox.hpp:36
VectorType lowerCorner
Lower corner of the bounding box.
Definition: BoundingBox.hpp:145
Box-ray intersection result.
Definition: BoundingBox.hpp:27