mirror of
https://github.com/godotengine/godot
synced 2024-09-04 21:58:28 +00:00
Merge pull request #87118 from AThousandShips/aabb_fix
[Core] Fix `AABB.encloses` failing on shared upper bound
This commit is contained in:
commit
f39baf0a58
|
@ -200,11 +200,11 @@ inline bool AABB::encloses(const AABB &p_aabb) const {
|
|||
|
||||
return (
|
||||
(src_min.x <= dst_min.x) &&
|
||||
(src_max.x > dst_max.x) &&
|
||||
(src_max.x >= dst_max.x) &&
|
||||
(src_min.y <= dst_min.y) &&
|
||||
(src_max.y > dst_max.y) &&
|
||||
(src_max.y >= dst_max.y) &&
|
||||
(src_min.z <= dst_min.z) &&
|
||||
(src_max.z > dst_max.z));
|
||||
(src_max.z >= dst_max.z));
|
||||
}
|
||||
|
||||
Vector3 AABB::get_support(const Vector3 &p_normal) const {
|
||||
|
|
|
@ -228,11 +228,20 @@ TEST_CASE("[AABB] Merging") {
|
|||
TEST_CASE("[AABB] Encloses") {
|
||||
const AABB aabb_big = AABB(Vector3(-1.5, 2, -2.5), Vector3(4, 5, 6));
|
||||
|
||||
CHECK_MESSAGE(
|
||||
aabb_big.encloses(aabb_big),
|
||||
"encloses() with itself should return the expected result.");
|
||||
|
||||
AABB aabb_small = AABB(Vector3(-1.5, 2, -2.5), Vector3(1, 1, 1));
|
||||
CHECK_MESSAGE(
|
||||
aabb_big.encloses(aabb_small),
|
||||
"encloses() with fully contained AABB (touching the edge) should return the expected result.");
|
||||
|
||||
aabb_small = AABB(Vector3(1.5, 6, 2.5), Vector3(1, 1, 1));
|
||||
CHECK_MESSAGE(
|
||||
aabb_big.encloses(aabb_small),
|
||||
"encloses() with fully contained AABB (touching the edge) should return the expected result.");
|
||||
|
||||
aabb_small = AABB(Vector3(0.5, 1.5, -2), Vector3(1, 1, 1));
|
||||
CHECK_MESSAGE(
|
||||
!aabb_big.encloses(aabb_small),
|
||||
|
|
Loading…
Reference in a new issue