File indexing completed on 2025-01-18 09:12:59
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <boost/test/tools/output_test_stream.hpp>
0010 #include <boost/test/unit_test.hpp>
0011
0012 #include "Acts/Tests/CommonHelpers/FloatComparisons.hpp"
0013 #include "Acts/Utilities/Ray.hpp"
0014
0015 namespace Acts::Test {
0016
0017 BOOST_AUTO_TEST_SUITE(Utilities)
0018 BOOST_AUTO_TEST_CASE(ray_construction) {
0019
0020
0021 using Vector2F = Eigen::Matrix<float, 2, 1>;
0022
0023 boost::test_tools::output_test_stream output;
0024
0025 Vector2F dir2(0.5, 0.5);
0026 Ray<float, 2> ray2({1, 1}, dir2);
0027 dir2.normalize();
0028
0029 BOOST_CHECK_EQUAL(ray2.origin(), Vector2F(1, 1));
0030 CHECK_CLOSE_ABS(ray2.dir(), dir2, 1e-6);
0031 Vector2F idir2 = 1. / dir2.array();
0032 CHECK_CLOSE_ABS(ray2.idir().matrix(), idir2, 1e-6);
0033
0034 ray2.toStream(output);
0035 BOOST_CHECK(!output.is_empty(true));
0036
0037
0038 using Vector3F = Eigen::Matrix<float, 3, 1>;
0039
0040 Vector3F dir3(1, 2, 1);
0041 Ray<float, 3> ray3({1, 2, 3}, dir3);
0042 dir3.normalize();
0043
0044 BOOST_CHECK_EQUAL(ray3.origin(), Vector3F(1, 2, 3));
0045 CHECK_CLOSE_ABS(ray3.dir(), dir3, 1e-6);
0046 CHECK_CLOSE_ABS(ray3.idir().matrix(), (1. / dir3.array()).matrix(), 1e-6);
0047
0048 ray3.toStream(output);
0049 BOOST_CHECK(!output.is_empty(true));
0050
0051
0052
0053
0054 }
0055 BOOST_AUTO_TEST_SUITE_END()
0056
0057 }