File indexing completed on 2025-01-18 09:13:03
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <boost/test/unit_test.hpp>
0010
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Tests/CommonHelpers/FloatComparisons.hpp"
0013 #include "Acts/Visualization/EventDataView3D.hpp"
0014 #include "Acts/Visualization/ObjVisualization3D.hpp"
0015 #include "Acts/Visualization/PlyVisualization3D.hpp"
0016
0017 #include <array>
0018 #include <cmath>
0019 #include <iostream>
0020 #include <numbers>
0021 #include <string>
0022 #include <vector>
0023
0024 #include "PrimitivesView3DBase.hpp"
0025 #include "Visualization3DTester.hpp"
0026
0027 namespace Acts::Test {
0028
0029 BOOST_AUTO_TEST_SUITE(Visualization)
0030
0031
0032
0033
0034 BOOST_AUTO_TEST_CASE(Visualization3DHelpers) {
0035
0036 SquareMatrix2 covariance;
0037 covariance << 4., 0., 0., 4.;
0038 auto decops = Acts::EventDataView3D::decomposeCovariance(covariance);
0039 BOOST_CHECK_EQUAL(decops[0], 4.);
0040 BOOST_CHECK_EQUAL(decops[1], 4.);
0041 BOOST_CHECK_EQUAL(decops[2], 0.);
0042
0043
0044 covariance.setZero();
0045 covariance << 4., 4., 4., 4.;
0046 decops = Acts::EventDataView3D::decomposeCovariance(covariance);
0047 BOOST_CHECK_EQUAL(decops[0], 8.);
0048 BOOST_CHECK_EQUAL(decops[1], 0.);
0049 CHECK_CLOSE_ABS(decops[2], std::numbers::pi / 4., 0.0001);
0050
0051
0052 covariance.setZero();
0053 covariance << 4., -4., -4., 4.;
0054 decops = Acts::EventDataView3D::decomposeCovariance(covariance);
0055 BOOST_CHECK_EQUAL(decops[0], 8.);
0056 BOOST_CHECK_EQUAL(decops[1], 0.);
0057 CHECK_CLOSE_ABS(decops[2], 3 * std::numbers::pi / 4., 0.0001);
0058
0059
0060 covariance.setZero();
0061 covariance << 4., 2., 2., 4.;
0062 decops = Acts::EventDataView3D::decomposeCovariance(covariance);
0063 BOOST_CHECK_EQUAL(decops[0], 6.);
0064 BOOST_CHECK_EQUAL(decops[1], 2.);
0065 CHECK_CLOSE_ABS(decops[2], std::numbers::pi / 4., 0.0001);
0066
0067
0068 covariance.setZero();
0069 covariance << 9., -3., -3, 4.;
0070 decops = Acts::EventDataView3D::decomposeCovariance(covariance);
0071 CHECK_CLOSE_ABS(decops[0], 10.4051, 0.0001);
0072 CHECK_CLOSE_ABS(decops[1], 2.59488, 0.0001);
0073 CHECK_CLOSE_ABS(decops[2], 2.70356, 0.0001);
0074 }
0075
0076 BOOST_AUTO_TEST_CASE(PrimitivesView3DObj) {
0077 ObjVisualization3D obj;
0078 auto objTest = PrimitivesView3DTest::run(obj);
0079 auto objErrors = testObjString(objTest);
0080 BOOST_CHECK(objErrors.empty());
0081 for (const auto& objerr : objErrors) {
0082 std::cout << objerr << std::endl;
0083 }
0084 }
0085
0086 BOOST_AUTO_TEST_CASE(PrimitivesView3DPly) {
0087 PlyVisualization3D ply;
0088 auto plyTest = PrimitivesView3DTest::run(ply);
0089 auto plyErrors = testPlyString(plyTest);
0090 BOOST_CHECK(plyErrors.empty());
0091 for (const auto& plyerr : plyErrors) {
0092 std::cout << plyerr << std::endl;
0093 }
0094 }
0095
0096 BOOST_AUTO_TEST_SUITE_END()
0097
0098 }