File indexing completed on 2026-05-27 07:24:22
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #include "detray/navigation/intersection/bounding_box/cuboid_intersector.hpp"
0011
0012 #include "detray/navigation/intersection/intersection.hpp"
0013 #include "detray/tracks/ray.hpp"
0014 #include "detray/utils/bounding_volume.hpp"
0015
0016
0017 #include "detray/test/framework/types.hpp"
0018
0019
0020 #include <gtest/gtest.h>
0021
0022 using namespace detray;
0023
0024 namespace {
0025
0026 using test_algebra = test::algebra;
0027 using scalar = test::scalar;
0028 using vector3 = test::vector3;
0029 using point3 = test::point3;
0030
0031
0032 constexpr scalar x_min{1.f * unit<scalar>::mm};
0033 constexpr scalar x_max{3.f * unit<scalar>::mm};
0034 constexpr scalar y_min{0.f * unit<scalar>::mm};
0035 constexpr scalar y_max{2.f * unit<scalar>::mm};
0036 constexpr scalar z_min{2.f * unit<scalar>::mm};
0037 constexpr scalar z_max{3.f * unit<scalar>::mm};
0038
0039
0040 constexpr scalar envelope{1.01f};
0041
0042 }
0043
0044
0045 GTEST_TEST(detray_intersection, cuboid_aabb_intersector) {
0046
0047 const point3 pos{2.f, 1.f, 0.f};
0048 const vector3 mom{0.f, 0.f, 1.f};
0049 const detail::ray<test_algebra> r(pos, 0.f, mom, 0.f);
0050
0051
0052 mask<cuboid3D, test_algebra> c3{0u, x_min, y_min, z_min, x_max, y_max, z_max};
0053 axis_aligned_bounding_volume<cuboid3D, test_algebra> aabb{c3, 0u, envelope};
0054
0055 ASSERT_TRUE(aabb.intersect(r));
0056 }