9 #include <boost/test/data/test_case.hpp>
10 #include <boost/test/unit_test.hpp>
22 namespace tt = boost::test_tools;
28 BOOST_AUTO_TEST_SUITE(Geometry)
31 double rmin{10.},
rmax{20.}, halfz{30.}, halfphi{
M_PI / 4}, avgphi{0.};
39 BOOST_CHECK_EQUAL(solidCylinderSector.orientedSurfaces().size(), 5);
43 BOOST_CHECK_EQUAL(tubeCylinder.orientedSurfaces().size(), 4);
47 BOOST_CHECK_EQUAL(tubeCylinderSector.orientedSurfaces().size(), 6);
52 double rmed = 0.5 * (rmin +
rmax);
53 double rthickness = (
rmax - rmin);
56 BOOST_CHECK_EQUAL(original, fromCylinder);
61 BOOST_CHECK_EQUAL(original, fromDisc);
65 BOOST_CHECK_EQUAL(original, copied);
69 BOOST_CHECK_EQUAL(original, assigned);
73 double rmin{10.},
rmax{20.}, halfz{30.}, halfphi{
M_PI / 4}, avgphi{0.};
76 std::array<double, CylinderVolumeBounds::eSize>
values;
77 std::vector<double> valvector = original.
values();
80 BOOST_CHECK_EQUAL(original, recreated);
84 double rmin{10.},
rmax{20.}, halfz{30.}, halfphi{
M_PI / 4}, avgphi{0.};
115 double rmed = 0.5 * (rmin +
rmax);
130 double rmin{10.},
rmax{20.}, halfz{30.}, halfphi{
M_PI / 4}, avgphi{0.};
145 bdata::random(-
M_PI,
M_PI) ^ bdata::random(-10., 10.) ^
146 bdata::random(-10., 10.) ^ bdata::random(-10., 10.) ^
148 alpha, beta,
gamma, posX, posY, posZ, index) {
179 (pos - boundarySurfaces.at(0).first->center(tgContext)).norm(),
182 (pos - boundarySurfaces.at(1).first->center(tgContext)).norm(),
186 (
transform.inverse() * boundarySurfaces.at(1).first->center(tgContext))
190 (
transform.inverse() * boundarySurfaces.at(0).first->center(tgContext))
193 BOOST_CHECK_LT(centerPosZ, posDiscPosZ);
194 BOOST_CHECK_GT(centerPosZ, negDiscPosZ);
207 transform.rotation().col(2).dot(boundarySurfaces.at(1).first->normal(
213 transform.rotation().col(2).dot(boundarySurfaces.at(0).first->normal(
232 BOOST_CHECK_EQUAL(bb.entity(),
nullptr);
233 BOOST_CHECK_EQUAL(bb.max(),
Vector3D(5, 5, 10));
234 BOOST_CHECK_EQUAL(bb.min(),
Vector3D(-5, -5, -10));
237 BOOST_CHECK_EQUAL(bb.entity(),
nullptr);
242 bb = cvb.boundingBox();
243 BOOST_CHECK_EQUAL(bb.entity(),
nullptr);
244 BOOST_CHECK_EQUAL(bb.max(),
Vector3D(8, 8, 12));
245 BOOST_CHECK_EQUAL(bb.min(),
Vector3D(-8, -8, -12));
247 double angle =
M_PI / 8.;
249 bb = cvb.boundingBox();
250 BOOST_CHECK_EQUAL(bb.entity(),
nullptr);
256 bb = cvb.boundingBox(&rot);
257 BOOST_CHECK_EQUAL(bb.entity(),
nullptr);
263 bb = cvb.boundingBox(&rot);
264 BOOST_CHECK_EQUAL(bb.entity(),
nullptr);
275 BOOST_CHECK_EQUAL(cvbOrientedSurfaces.size(), 4);
282 for (
auto& os : cvbOrientedSurfaces) {
283 auto onSurface = os.first->binningPosition(geoCtx,
binR);
284 auto osNormal = os.first->normal(geoCtx, onSurface);
285 double nDir = (double)os.second;
287 auto insideCvb = onSurface + nDir * osNormal;
288 auto outsideCvb = onSurface - nDir * osNormal;
290 BOOST_CHECK(cvb.
inside(insideCvb));
291 BOOST_CHECK(!cvb.
inside(outsideCvb));
294 auto rot = os.first->transform(geoCtx).rotation();
295 BOOST_CHECK(rot.col(0).isApprox(xaxis));
296 BOOST_CHECK(rot.col(1).isApprox(yaxis));
297 BOOST_CHECK(rot.col(2).isApprox(zaxis));
301 BOOST_AUTO_TEST_SUITE_END()