9 #include <boost/test/unit_test.hpp>
25 BOOST_AUTO_TEST_SUITE(Geometry)
33 BOOST_CHECK_EQUAL(box, copied);
37 BOOST_CHECK_EQUAL(box, assigned);
42 auto valvector = original.
values();
43 std::array<double, CuboidVolumeBounds::eSize>
values;
46 BOOST_CHECK_EQUAL(original, recreated);
77 std::vector<double> actvalues = box.
values();
78 std::vector<double> refvalues = {
hx,
hy,
hz};
79 BOOST_CHECK_EQUAL_COLLECTIONS(actvalues.begin(), actvalues.end(),
80 refvalues.begin(), refvalues.end());
85 std::vector<Vector3D> outsides = {
86 {20., 1., -2.}, {1., -30., 2.}, {-1., 2., 100.}};
92 for (
const auto& outside : outsides) {
101 BOOST_CHECK_EQUAL(cvbOrientedSurfaces.size(), 6);
105 for (
auto& os : cvbOrientedSurfaces) {
106 auto osCenter = os.first->center(geoCtx);
107 auto osNormal = os.first->normal(geoCtx);
108 double nDir = (double)os.second;
110 auto insideBox = osCenter + nDir * osNormal;
111 auto outsideBox = osCenter - nDir * osNormal;
112 BOOST_CHECK(box.
inside(insideBox));
113 BOOST_CHECK(!box.
inside(outsideBox));
122 cvbOrientedSurfaces[
negativeFaceXY].first->transform(geoCtx).rotation();
123 BOOST_CHECK(nFaceXY.col(0).isApprox(xaxis));
124 BOOST_CHECK(nFaceXY.col(1).isApprox(yaxis));
125 BOOST_CHECK(nFaceXY.col(2).isApprox(zaxis));
128 cvbOrientedSurfaces[
positiveFaceXY].first->transform(geoCtx).rotation();
129 BOOST_CHECK(pFaceXY.col(0).isApprox(xaxis));
130 BOOST_CHECK(pFaceXY.col(1).isApprox(yaxis));
131 BOOST_CHECK(pFaceXY.col(2).isApprox(zaxis));
134 cvbOrientedSurfaces[
negativeFaceYZ].first->transform(geoCtx).rotation();
135 BOOST_CHECK(nFaceYZ.col(0).isApprox(yaxis));
136 BOOST_CHECK(nFaceYZ.col(1).isApprox(zaxis));
137 BOOST_CHECK(nFaceYZ.col(2).isApprox(xaxis));
140 cvbOrientedSurfaces[
positiveFaceYZ].first->transform(geoCtx).rotation();
141 BOOST_CHECK(pFaceYZ.col(0).isApprox(yaxis));
142 BOOST_CHECK(pFaceYZ.col(1).isApprox(zaxis));
143 BOOST_CHECK(pFaceYZ.col(2).isApprox(xaxis));
146 cvbOrientedSurfaces[
negativeFaceZX].first->transform(geoCtx).rotation();
147 BOOST_CHECK(nFaceZX.col(0).isApprox(zaxis));
148 BOOST_CHECK(nFaceZX.col(1).isApprox(xaxis));
149 BOOST_CHECK(nFaceZX.col(2).isApprox(yaxis));
152 cvbOrientedSurfaces[
positiveFaceZX].first->transform(geoCtx).rotation();
153 BOOST_CHECK(pFaceZX.col(0).isApprox(zaxis));
154 BOOST_CHECK(pFaceZX.col(1).isApprox(xaxis));
155 BOOST_CHECK(pFaceZX.col(2).isApprox(yaxis));
158 BOOST_AUTO_TEST_SUITE_END()