Commit c8db7ef8 authored by Julian Schakib's avatar Julian Schakib
Browse files

intersection tests for box and plane

parent e6691ed6
Pipeline #13780 failed with stage
in 6 minutes and 26 seconds
typed-geometry @ b26a52a4
Subproject commit 71aeccbb4212dc12be6b1ff4eb14827d0a53feba Subproject commit b26a52a4e77285201be41172b75839938efcf48b
...@@ -330,6 +330,8 @@ TG_FUZZ_TEST(Plane, Intersect) ...@@ -330,6 +330,8 @@ TG_FUZZ_TEST(Plane, Intersect)
// plane3 - box3 // plane3 - box3
{ {
auto const origins = tg::aabb3(tg::pos3(-10), tg::pos3(10));
auto half_extents = tg::mat3(); auto half_extents = tg::mat3();
half_extents[0] = tg::dir3::pos_x; half_extents[0] = tg::dir3::pos_x;
half_extents[1] = tg::dir3::pos_y; half_extents[1] = tg::dir3::pos_y;
...@@ -360,8 +362,15 @@ TG_FUZZ_TEST(Plane, Intersect) ...@@ -360,8 +362,15 @@ TG_FUZZ_TEST(Plane, Intersect)
half_extents[1] = ny * uniform(rng, 1.0f, 10.0f); half_extents[1] = ny * uniform(rng, 1.0f, 10.0f);
half_extents[2] = nz * uniform(rng, 1.0f, 10.0f); half_extents[2] = nz * uniform(rng, 1.0f, 10.0f);
auto const box box = tg::box3(uniform(rng, origins), half_extents);
auto const plane = tg::plane3(tg::uniform<tg::dir3>(rng), tg::pos3::zero) {
auto const plane = tg::plane3(nx, tg::pos3(box.center + half_extents[0] * 1.1f));
CHECK(!intersects(plane, box));
}
{
auto const plane = tg::plane3(nx, tg::pos3(box.center + half_extents[0] * 0.9f));
CHECK(intersects(plane, box));
}
} }
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment