22 [[nodiscard]]
constexpr BoundingBox() noexcept : min(0), max(0) {}
23 [[nodiscard]]
constexpr BoundingBox(
class BoundingBox
const& k)
noexcept =
default;
24 constexpr BoundingBox& operator=(
class BoundingBox
const& k)
noexcept =
default;
25 [[nodiscard]]
constexpr BoundingBox(
BlockPos const& min,
BlockPos const& max) noexcept : min(min), max(max) {}
28 for (
int dy = min.y; dy <= max.y; ++dy)
29 for (
int dx = min.x; dx <= max.x; ++dx)
30 for (
int dz = min.z; dz <= max.z; ++dz) {
35 constexpr BoundingBox& merge(BoundingBox
const& a)
noexcept {
36 *
this = BoundingBox{ll::math::min(a.min, min), ll::math::max(a.max, max)};
40 constexpr BoundingBox& merge(
BlockPos const& a)
noexcept {
41 *
this = BoundingBox{ll::math::min(a, min), ll::math::max(a, max)};
45 template <
typename T,
size_t N>
46 [[nodiscard]]
constexpr T& get()
noexcept {
47 if constexpr (N == 0) {
49 }
else if constexpr (N == 1) {
52 static_assert(ll::traits::always_false<T>);
56 template <
typename T,
size_t N>
57 [[nodiscard]]
constexpr T
const& get()
const noexcept {
58 if constexpr (N == 0) {
60 }
else if constexpr (N == 1) {
63 static_assert(ll::traits::always_false<T>);
67 [[nodiscard]]
bool contains(
BlockPos const& a)
const noexcept {
return a.ge(min).all() && a.le(max).all(); }
69 [[nodiscard]]
bool contains(BoundingBox
const& a)
const noexcept {
70 return a.min.ge(min).all() && a.max.le(max).all();
73 [[nodiscard]]
BlockPos getSideLength()
const noexcept {
return max - min + 1; }
75 LLNDAPI
operator class AABB() const;
80 MCAPI
void applyTransformation(
::BlockPos const& pivot, ::Rotation rotationXZ,
bool mirrorX,
bool mirrorZ);
86 MCAPI static ::std::optional<::BoundingBox> intersect(::BoundingBox
const& lhs, ::BoundingBox
const& rhs);