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

new tg, aabb3 intersection tests

parent 9f324c85
Pipeline #13406 passed with stage
in 6 minutes and 22 seconds
typed-geometry @ 9349e3d8
Subproject commit c2b6cbcbb28194a28ac85fab30271060de82edce
Subproject commit 9349e3d864155f776460192952e58a24ad96dc3b
......@@ -2,6 +2,40 @@
#include <typed-geometry/tg-std.hh>
TG_FUZZ_TEST(TypedGeometry, IntersectionRay3AABB3)
{
auto box3 = tg::aabb3(tg::pos3(0.0f), tg::pos3(10.0f));
auto min = uniform(rng, box3);
auto aabb = tg::aabb3(min, uniform(rng, box3) + tg::vec3(min));
auto diag = normalize(aabb.max - min);
{
auto ray = tg::ray3(min, diag);
CHECK(tg::intersects(ray, aabb));
}
{
auto ray = tg::ray3(aabb.max + diag, diag);
CHECK(!tg::intersects(ray, aabb));
}
// axis aligned rays
{
auto ray = tg::ray3(aabb.max + tg::dir3::pos_z * 0.1f, tg::dir3::neg_z);
CHECK(tg::intersects(ray, aabb, tg::f32(0.01f)));
}
{
auto ray = tg::ray3(aabb.max + tg::dir3::pos_x * 0.1f, tg::dir3::neg_x);
CHECK(tg::intersects(ray, aabb, tg::f32(0.01f)));
}
{
auto ray = tg::ray3(aabb.max + tg::dir3::pos_x * 0.1f, tg::dir3::neg_x);
CHECK(tg::intersects(ray, aabb, tg::f32(0.01f)));
}
}
TG_FUZZ_TEST(TypedGeometry, IntersectionRay3InfCone3)
{
auto box3 = tg::aabb3(tg::pos3(-10.0f), tg::pos3(10.0f));
......
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