Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-27 07:24:22

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 // Project include(s)
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 // Detray test include(s)
0017 #include "detray/test/framework/types.hpp"
0018 
0019 // GTest include
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 // cuboid
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 // envelope around wrapped object (scalor in percent)
0040 constexpr scalar envelope{1.01f};
0041 
0042 }  // anonymous namespace
0043 
0044 // This test the intersection between ray and cuboid aabb
0045 GTEST_TEST(detray_intersection, cuboid_aabb_intersector) {
0046   // Test ray
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   // The bounding box
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 }