9 #include <boost/test/data/test_case.hpp>
10 #include <boost/test/unit_test.hpp>
36 BOOST_AUTO_TEST_SUITE(Geometry)
42 auto recBounds = std::make_shared<RectangleBounds>(3., 6.);
47 Transform3::Identity();
50 Transform3::Identity();
52 std::vector<std::shared_ptr<const Surface>> surfaceStore;
53 surfaceStore.reserve(100);
55 auto createProtoLayer = [&](
const Transform3& trf,
57 auto atNegX = Surface::makeShared<PlaneSurface>(
61 auto atPosX = Surface::makeShared<PlaneSurface>(
65 auto atNegY = Surface::makeShared<PlaneSurface>(
69 auto atPosY = Surface::makeShared<PlaneSurface>(
73 std::vector<std::shared_ptr<const Surface>> sharedSurfaces = {
74 atNegX, atNegY, atPosX, atPosY};
75 surfaceStore.insert(surfaceStore.begin(), sharedSurfaces.begin(),
76 sharedSurfaces.end());
78 std::vector<const Surface*> surfaces = {atNegX.get(), atNegY.get(),
79 atPosX.get(), atPosY.get()};
87 auto pLayerSf = createProtoLayer(Transform3::Identity());
88 auto pLayerSfShared = createProtoLayer(Transform3::Identity());
90 BOOST_CHECK(pLayerSf.extent.range() == pLayerSfShared.extent.range());
91 BOOST_CHECK(pLayerSf.envelope == pLayerSfShared.envelope);
94 BOOST_CHECK(pLayerSf.surfaces().size() == 4);
96 auto rB = std::make_shared<RectangleBounds>(30., 60.);
100 Surface::makeShared<PlaneSurface>(Transform3::Identity(), rB);
102 pLayerSf.add(tgContext, *addSurface.get());
104 BOOST_CHECK(pLayerSf.surfaces().size() == 5);
107 BOOST_CHECK(!(pLayerSf.extent.range() == pLayerSfShared.extent.range()));
110 auto protoLayer = createProtoLayer(Transform3::Identity());
131 auto protoLayerRot = createProtoLayer(
AngleAxis3(-0.345, Vector3::UnitZ()) *
132 Transform3::Identity());
134 BOOST_CHECK_NE(protoLayer.min(
binX), -6.);
144 std::stringstream sstream;
145 protoLayerRot.toStream(sstream);
146 std::string oString = R
"(ProtoLayer with dimensions (min/max)
Extent in space :
- value : binX | range = [-6.66104, 6.66104]
- value : binY | range = [-4.85241, 4.85241]
- value : binZ | range = [-6, 6]
- value : binR | range = [3, 6.7082]
- value : binPhi | range = [-3.02295, 2.33295]
- value : binRPhi | range = [-20.2785, 15.6499]
- value : binH | range = [0.61548, 2.52611]
- value : binEta | range = [-1.14622, 1.14622]
- value : binMag | range = [7.34847, 7.34847]
)";
147 BOOST_CHECK_EQUAL(sstream.str(), oString);
150 BOOST_AUTO_TEST_SUITE_END()