9 #include <boost/test/unit_test.hpp>
35 BOOST_AUTO_TEST_SUITE(Geometry)
43 BOOST_CHECK_EQUAL(box, copied);
47 BOOST_CHECK_EQUAL(box, assigned);
52 auto valvector = original.
values();
53 std::array<double, CuboidVolumeBounds::eSize>
values{};
56 BOOST_CHECK_EQUAL(original, recreated);
87 std::vector<double> actvalues = box.
values();
88 std::vector<double> refvalues = {
hx,
hy,
hz};
89 BOOST_CHECK_EQUAL_COLLECTIONS(actvalues.begin(), actvalues.end(),
90 refvalues.begin(), refvalues.end());
95 std::vector<Vector3> outsides = {
96 {20., 1., -2.}, {1., -30., 2.}, {-1., 2., 100.}};
102 for (
const auto& outside : outsides) {
118 BOOST_CHECK_EQUAL(cvbOrientedSurfaces.size(), 6);
122 for (
auto&
os : cvbOrientedSurfaces) {
123 auto osCenter =
os.first->center(geoCtx);
124 auto osNormal =
os.first->normal(geoCtx);
126 Vector3 insideBox = osCenter +
os.second * osNormal;
127 Vector3 outsideBox = osCenter -
os.second * osNormal;
128 BOOST_CHECK(box.
inside(insideBox));
129 BOOST_CHECK(!box.
inside(outsideBox));
138 cvbOrientedSurfaces[
negativeFaceXY].first->transform(geoCtx).rotation();
139 BOOST_CHECK(nFaceXY.col(0).isApprox(xaxis));
140 BOOST_CHECK(nFaceXY.col(1).isApprox(yaxis));
141 BOOST_CHECK(nFaceXY.col(2).isApprox(zaxis));
144 cvbOrientedSurfaces[
positiveFaceXY].first->transform(geoCtx).rotation();
145 BOOST_CHECK(pFaceXY.col(0).isApprox(xaxis));
146 BOOST_CHECK(pFaceXY.col(1).isApprox(yaxis));
147 BOOST_CHECK(pFaceXY.col(2).isApprox(zaxis));
150 cvbOrientedSurfaces[
negativeFaceYZ].first->transform(geoCtx).rotation();
151 BOOST_CHECK(nFaceYZ.col(0).isApprox(yaxis));
152 BOOST_CHECK(nFaceYZ.col(1).isApprox(zaxis));
153 BOOST_CHECK(nFaceYZ.col(2).isApprox(xaxis));
156 cvbOrientedSurfaces[
positiveFaceYZ].first->transform(geoCtx).rotation();
157 BOOST_CHECK(pFaceYZ.col(0).isApprox(yaxis));
158 BOOST_CHECK(pFaceYZ.col(1).isApprox(zaxis));
159 BOOST_CHECK(pFaceYZ.col(2).isApprox(xaxis));
162 cvbOrientedSurfaces[
negativeFaceZX].first->transform(geoCtx).rotation();
163 BOOST_CHECK(nFaceZX.col(0).isApprox(zaxis));
164 BOOST_CHECK(nFaceZX.col(1).isApprox(xaxis));
165 BOOST_CHECK(nFaceZX.col(2).isApprox(yaxis));
168 cvbOrientedSurfaces[
positiveFaceZX].first->transform(geoCtx).rotation();
169 BOOST_CHECK(pFaceZX.col(0).isApprox(zaxis));
170 BOOST_CHECK(pFaceZX.col(1).isApprox(xaxis));
171 BOOST_CHECK(pFaceZX.col(2).isApprox(yaxis));
174 BOOST_AUTO_TEST_SUITE_END()