File indexing completed on 2026-07-31 08:18:45
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/Surfaces/PointBounds.hpp"
0013 #include "Acts/Surfaces/SurfaceBounds.hpp"
0014
0015 #include <stdexcept>
0016 #include <vector>
0017
0018 using namespace Acts;
0019
0020 namespace ActsTests {
0021
0022 BOOST_AUTO_TEST_SUITE(SurfacesSuite)
0023
0024
0025 BOOST_AUTO_TEST_CASE(PointBoundsConstruction) {
0026 double maxDistance = 3.;
0027 PointBounds pointBounds(maxDistance);
0028 BOOST_CHECK_EQUAL(pointBounds.type(), SurfaceBounds::ePoint);
0029
0030
0031 PointBounds copied(pointBounds);
0032 BOOST_CHECK_EQUAL(copied.type(), SurfaceBounds::ePoint);
0033 BOOST_CHECK_EQUAL(copied.get(PointBounds::eR), maxDistance);
0034 }
0035
0036
0037 BOOST_AUTO_TEST_CASE(PointBoundsProperties) {
0038 double maxDistance = 3.;
0039 PointBounds pointBounds(maxDistance);
0040
0041 BOOST_CHECK_EQUAL(pointBounds.get(PointBounds::eR), maxDistance);
0042 BOOST_CHECK(pointBounds.isCartesian());
0043
0044
0045 std::vector<double> values = pointBounds.values();
0046 BOOST_CHECK_EQUAL(values.size(), 1u);
0047 BOOST_CHECK_EQUAL(values[0], maxDistance);
0048
0049
0050 BOOST_CHECK_EQUAL(pointBounds.center(), Vector2::Zero());
0051 }
0052
0053
0054 BOOST_AUTO_TEST_CASE(PointBoundsInside) {
0055 double maxDistance = 3.;
0056 PointBounds pointBounds(maxDistance);
0057
0058 BOOST_CHECK(pointBounds.inside(Vector2(0., 0.)));
0059 BOOST_CHECK(pointBounds.inside(Vector2(2., 2.)));
0060 BOOST_CHECK(pointBounds.inside(Vector2(3., 0.)));
0061 BOOST_CHECK(pointBounds.inside(Vector2(0., -3.)));
0062 BOOST_CHECK(!pointBounds.inside(Vector2(3., 3.)));
0063 BOOST_CHECK(!pointBounds.inside(Vector2(-2.5, -2.)));
0064 }
0065
0066
0067 BOOST_AUTO_TEST_CASE(PointBoundsClosestPoint) {
0068 double maxDistance = 3.;
0069 PointBounds pointBounds(maxDistance);
0070
0071 Vector2 closest =
0072 pointBounds.closestPoint(Vector2(6., 0.), SquareMatrix2::Identity());
0073 BOOST_CHECK_CLOSE(closest.x(), 3., 1e-9);
0074 BOOST_CHECK_SMALL(closest.y(), 1e-9);
0075
0076
0077 Vector2 fromOrigin =
0078 pointBounds.closestPoint(Vector2(0., 0.), SquareMatrix2::Identity());
0079 BOOST_CHECK_CLOSE(fromOrigin.norm(), 3., 1e-9);
0080 }
0081
0082
0083 BOOST_AUTO_TEST_CASE(PointBoundsException) {
0084 BOOST_CHECK_THROW(PointBounds(-1.), std::invalid_argument);
0085 }
0086
0087 BOOST_AUTO_TEST_SUITE_END()
0088
0089 }