diff --git a/tests/general/unit_test_gjk.cpp b/tests/general/unit_test_gjk.cpp index bd0fdac..8c306cc 100644 --- a/tests/general/unit_test_gjk.cpp +++ b/tests/general/unit_test_gjk.cpp @@ -43,4 +43,25 @@ TEST(UnitTestGjk, TestCollisionFalse) const auto result = omath::collision::GjkAlgorithm<>::is_collide(collider_a, collider_b); EXPECT_FALSE(result); +} + +TEST(UnitTestGjk, TestCollisionEqualOrigin) +{ + const std::vector> mesh = { + {-1.f, -1.f, -1.f}, + {-1.f, -1.f, 1.f}, + {-1.f, 1.f, -1.f}, + {-1.f, 1.f, 1.f}, + { 1.f, 1.f, 1.f}, // x = +1 vertices (put {1,1,1} first in case your support breaks ties by first-hit) + { 1.f, 1.f, -1.f}, + { 1.f, -1.f, 1.f}, + { 1.f, -1.f, -1.f} + }; + + const omath::collision::MeshCollider collider_a(mesh, {0.f, 0.f, 0.f}); + const omath::collision::MeshCollider collider_b(mesh, {0.f, 0.f, 0.f}); + + const auto result = omath::collision::GjkAlgorithm<>::is_collide(collider_a, collider_b); + + EXPECT_TRUE(result); } \ No newline at end of file