Commit cc985dd8 authored by Philip Trettner's avatar Philip Trettner
Browse files

started aabb tests

parent 712587b8
Pipeline #13639 failed with stage
in 6 minutes and 37 seconds
...@@ -21,3 +21,33 @@ TG_FUZZ_TEST(TypedGeometry, AABB) ...@@ -21,3 +21,33 @@ TG_FUZZ_TEST(TypedGeometry, AABB)
CHECK(b.min.y <= p1.y); CHECK(b.min.y <= p1.y);
CHECK(b.min.z <= p1.z); CHECK(b.min.z <= p1.z);
} }
TG_FUZZ_TEST(TypedGeometry, ObjectAABB)
{
auto bb2 = tg::aabb2(-10, 10);
auto bb3 = tg::aabb3(-10, 10);
auto test_obj = [&](auto obj) {
auto bb = aabb_of(obj);
auto p = uniform(rng, obj);
CHECK(contains(bb, p));
};
// aabb
test_obj(aabb_of(uniform(rng, bb2), uniform(rng, bb2)));
test_obj(aabb_of(uniform(rng, bb3), uniform(rng, bb3)));
// sphere
test_obj(tg::sphere2(uniform(rng, bb2), uniform(rng, 0.5f, 3.0f)));
test_obj(tg::sphere3(uniform(rng, bb3), uniform(rng, 0.5f, 3.0f)));
// segment
test_obj(tg::segment(uniform(rng, bb2), uniform(rng, bb2)));
test_obj(tg::segment(uniform(rng, bb3), uniform(rng, bb3)));
// triangle
test_obj(tg::triangle(uniform(rng, bb2), uniform(rng, bb2), uniform(rng, bb2)));
test_obj(tg::triangle(uniform(rng, bb3), uniform(rng, bb3), uniform(rng, bb3)));
// TODO: more
}
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