9 #include <boost/test/unit_test.hpp>
29 BOOST_AUTO_TEST_SUITE(Volumes)
32 std::array<Vector3D, 8> vertices;
33 vertices = {{{0, 0, 0},
43 BOOST_CHECK(cubo.
inside({0.5, 0.5, 0.5}));
44 BOOST_CHECK(cubo.inside({1.5, 0.5, 0.5}));
45 BOOST_CHECK(!cubo.inside({2.5, 0.5, 0.5}));
46 BOOST_CHECK(!cubo.inside({0.5, 1.5, 0.5}));
47 BOOST_CHECK(!cubo.inside({0.5, 0.5, 1.5}));
48 BOOST_CHECK(!cubo.inside({-0.5, 0.5, 0.5}));
50 BOOST_CHECK(!cubo.inside({2.2, 1, 1}, 0.1));
51 BOOST_CHECK(cubo.inside({2.2, 1, 1}, 0.21));
52 BOOST_CHECK(cubo.inside({2.2, 1, 1}, 0.3));
56 std::array<Vector3D, 8> vertices;
57 vertices = {{{0, 0, 0},
67 auto is_in = [](
const auto& tvtx,
const auto& vertices_) {
68 for (
const auto&
vtx : vertices_) {
77 for (
const auto& srf : surfaces) {
78 auto pbounds =
dynamic_cast<const PlanarBounds*
>(&srf.first->bounds());
79 for (
const auto&
vtx : pbounds->vertices()) {
82 BOOST_CHECK(is_in(glob, vertices));
86 vertices = {{{0, 0, 0},
97 for (
const auto& srf : surfaces) {
98 auto pbounds =
dynamic_cast<const PlanarBounds*
>(&srf.first->bounds());
99 for (
const auto&
vtx : pbounds->vertices()) {
102 BOOST_CHECK(is_in(glob, vertices));
111 for (
const auto& srf : surfaces) {
112 auto pbounds =
dynamic_cast<const PlanarBounds*
>(&srf.first->bounds());
113 for (
const auto&
vtx : pbounds->vertices()) {
116 BOOST_CHECK(is_in(trf.inverse() * glob, vertices));
122 std::array<Vector3D, 8> vertices;
123 vertices = {{{0, 0, 0},
135 std::ofstream os(
"cuboid.ply");
136 os << ply << std::flush;
142 std::array<Vector3D, 8> vertices;
143 vertices = {{{0, 0, 0},
158 BOOST_CHECK_EQUAL(bb.entity(),
nullptr);
159 BOOST_CHECK_EQUAL(bb.max(),
Vector3D(2, 1, 1));
160 BOOST_CHECK_EQUAL(bb.min(),
Vector3D(0., 0., 0.));
164 BOOST_CHECK_EQUAL(bb.entity(),
nullptr);
166 BOOST_CHECK_EQUAL(bb.min(),
Vector3D(0, -1, 0));
170 BOOST_CHECK_EQUAL(bb.entity(),
nullptr);
178 BOOST_CHECK_EQUAL(bb.entity(),
nullptr);
184 std::array<Vector3D, 8> vertices;
185 vertices = {{{0, 0, 0},
197 BOOST_CHECK_EQUAL(gcvbOrientedSurfaces.size(), 6);
199 for (
auto& os : gcvbOrientedSurfaces) {
201 auto osCenter = os.first->center(
geoCtx);
202 auto osNormal = os.first->normal(
geoCtx);
203 double nDir = (double)os.second;
205 auto insideGcvb = osCenter + nDir * osNormal;
206 auto outsideGcvb = osCenter - nDir * osNormal;
207 BOOST_CHECK(cubo.
inside(insideGcvb));
208 BOOST_CHECK(!cubo.
inside(outsideGcvb));
212 BOOST_AUTO_TEST_SUITE_END()