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

more intersection tests

parent 3e98aaec
Pipeline #13532 passed with stage
in 6 minutes and 27 seconds
typed-geometry @ d55fdba4
Subproject commit 3446ae9964e4487496169aa5d1195edfd6aad88e
Subproject commit d55fdba43cb02289a74111d770d779cae2d6ced4
......@@ -19,10 +19,24 @@ TG_FUZZ_TEST(Plane, Intersect)
// plane3 - sphere3
{
auto const r = tg::uniform(rng, 0.1f, 10.0f);
auto const o = uniform(rng, bounds);
auto const p = tg::plane(tg::uniform<tg::dir3>(rng), o);
auto const s = tg::sphere3(o, 1);
auto const s = tg::sphere3(o, r);
CHECK(tg::intersects(p, s));
// tangent
auto const ts = tg::sphere3(o + p.normal * r, r);
CHECK(tg::intersects(p, ts, r / 1000));
// off
auto const toff = tg::sphere3(o + p.normal * (r + 0.1f), r);
CHECK(!tg::intersects(p, toff, tg::epsilon<tg::f32> * 20));
// orthogonally moved
auto const to = tg::sphere3(o + tg::any_normal(p.normal) * 10, r);
CHECK(tg::intersects(p, to));
}
}
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