24 Vec3 max, y, g, t, z, b, p;
27 [[nodiscard]]
constexpr AABB() noexcept : min(0), max(0) {}
28 [[nodiscard]]
constexpr AABB(
class AABB const& k) noexcept : min(k.min), max(k.max) {}
29 [[nodiscard]]
constexpr AABB(
class Vec3 const& min,
class Vec3 const& max) noexcept : min(min), max(max) {}
31 inline AABB& merge(
AABB const& a)
noexcept {
32 *
this =
AABB{ll::math::min(a.min, min), ll::math::max(a.max, max)};
36 inline AABB& merge(
Vec3 const& a)
noexcept {
37 *
this =
AABB{ll::math::min(a, min), ll::math::max(a, max)};
41 template <
typename T,
size_t N>
42 [[nodiscard]]
constexpr T& get()
noexcept {
43 if constexpr (N == 0) {
45 }
else if constexpr (N == 1) {
48 static_assert(ll::traits::always_false<T>);
52 template <
typename T,
size_t N>
53 [[nodiscard]]
constexpr T
const& get()
const noexcept {
54 if constexpr (N == 0) {
56 }
else if constexpr (N == 1) {
59 static_assert(ll::traits::always_false<T>);
63 [[nodiscard]]
constexpr bool contains(
Vec3 const& a)
const noexcept {
return a.ge(min).all() && a.le(max).all(); }
65 [[nodiscard]]
constexpr bool contains(
AABB const& a)
const noexcept {
66 return a.min.ge(min).all() && a.max.le(max).all();
71 LLAPI
bool intersects(
::AABB const& c)
const;
73 [[nodiscard]]
constexpr Vec3 center()
const noexcept {
return (min + max) * 0.5f; }
75 [[nodiscard]]
constexpr AABB& shrink(
float f)
noexcept {
84 MCAPI ::AABBHitResult clip(
::Vec3 const& a,
::Vec3 const& b)
const;
86 MCAPI ::AABB cloneAndExpandAlongDirection(
::Vec3 const& direction)
const;
88 MCAPI ::AABB cloneAndFloor(
float offsetMin,
float offsetMax)
const;
90 MCAPI ::AABB cloneAndFloorMinAndCeilingMax()
const;
92 MCAPI ::AABB cloneAndGrow(
::Vec3 const& distance)
const;
94 MCAPI ::AABB cloneAndGrow(
float radius)
const;
96 MCAPI ::AABB cloneAndShrink(
::Vec3 const& offset)
const;
98 MCAPI ::AABB cloneAndTransformByMatrix(
::Matrix const& transform)
const;
100 MCAPI
float distanceTo(
::Vec3 const& pos)
const;
102 MCAPI
float distanceToSqr(
::AABB const& aabb)
const;
104 MCAPI
bool intersectSegment(
105 ::Vec3 const& segmentBegin,
111 MCAPI
bool intersects(
::Vec3 const& segmentBegin,
::Vec3 const& segmentEnd)
const;
113 MCAPI
bool intersectsInner(
::AABB const& c)
const;
119 MCAPI static ::ClipCollideResult
126 MCAPI static ::AABB
const& BLOCK_SHAPE();
128 MCAPI static ::AABB
const& BOX_AT_ORIGIN_WITH_NO_VOLUME();