diff options
| author | aura <nw@moneybot.cc> | 2026-03-03 16:16:06 +0100 |
|---|---|---|
| committer | aura <nw@moneybot.cc> | 2026-03-03 16:16:06 +0100 |
| commit | e57cac01b0a4eb764185e8eca9396a25b83f34d3 (patch) | |
| tree | 37847002df4bdb984903362e9fa1134038f92d0e /src/util/aabb.h | |
| parent | b3a92fa1ffc565c2fc72b1a531cae09cbbc219bd (diff) | |
edge planes )))bsp-edges
Diffstat (limited to 'src/util/aabb.h')
| -rw-r--r-- | src/util/aabb.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/util/aabb.h b/src/util/aabb.h index 96e40bf..9dc4b20 100644 --- a/src/util/aabb.h +++ b/src/util/aabb.h @@ -13,3 +13,23 @@ inline F32 aabb_support_radius( const AABB& aabb, const VEC3& dir ) { VEC3 half = aabb_half( aabb ); return fabsf(dir.x) * half.x + fabsf(dir.y) * half.y + fabsf(dir.z) * half.z; } + +inline U8 aabb_intersects( const AABB& aabb, const AABB& other ) { + if (aabb.min.x > other.max.x || aabb.max.x < other.min.x) + return 0; + if (aabb.min.y > other.max.y || aabb.max.y < other.min.y) + return 0; + if (aabb.min.z > other.max.z || aabb.max.z < other.min.z) + return 0; + return 1; +} + +inline U8 aabb_contains_point( const AABB& aabb, const VEC3& point ) { + if (point.x < aabb.min.x || point.x > aabb.max.x) + return 0; + if (point.y < aabb.min.y || point.y > aabb.max.y) + return 0; + if (point.z < aabb.min.z || point.z > aabb.max.z) + return 0; + return 1; +} |
