sandbox
Loading...
Searching...
No Matches
box.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
24#ifndef LIBSBX_MATH_BOX_HPP_
25#define LIBSBX_MATH_BOX_HPP_
26
27#include <array>
28#include <cstddef>
29#include <utility>
30
32#include <libsbx/math/plane.hpp>
33#include <libsbx/math/vector3.hpp>
34
35namespace sbx::math {
36
45template<scalar Type>
46class basic_box {
47
48public:
49
53 using value_type = Type;
54
59
64
68 using size_type = std::size_t;
69
73 basic_box() noexcept = default;
74
80 basic_box(const std::array<plane_type, 6u>& planes) noexcept;
81
87 basic_box(std::array<plane_type, 6u>&& planes) noexcept;
88
99 auto intersects(const volume_type& volume) const -> bool;
100
106 auto planes() const noexcept -> const std::array<plane_type, 6u>&;
107
115 auto plane(const size_type index) const noexcept -> const plane_type&;
116
117private:
118
119 std::array<plane_type, 6u> _planes;
120
121}; // class basic_box
122
126using boxf = basic_box<std::float_t>;
127
131using box = boxf;
132
133} // namespace sbx::math
134
135#include <libsbx/math/box.ipp>
136
137#endif // LIBSBX_MATH_BOX_HPP_
Plane-based box represented by six clipping planes.
Definition: box.hpp:46
Type value_type
Underlying scalar value type.
Definition: box.hpp:53
auto intersects(const volume_type &volume) const -> bool
Tests whether this box intersects a volume.
Definition: box.ipp:15
std::size_t size_type
Index type for plane access.
Definition: box.hpp:68
auto planes() const noexcept -> const std::array< plane_type, 6u > &
Returns the plane array backing this box.
Definition: box.ipp:33
basic_box() noexcept=default
Constructs an empty box.
Definition: plane.hpp:12
Definition: volume.hpp:14
Core numeric concepts and type traits.