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->bounds());
79 for (
const auto& vtx : pbounds->vertices()) {
81 srf->localToGlobal(
gctx, vtx, {}, glob);
83 BOOST_CHECK(is_in(glob, vertices));
87 vertices = {{{0, 0, 0},
98 for (
const auto& srf : surfaces) {
99 auto pbounds =
dynamic_cast<const PlanarBounds*
>(&srf->bounds());
100 for (
const auto& vtx : pbounds->vertices()) {
102 srf->localToGlobal(
gctx, vtx, {}, glob);
104 BOOST_CHECK(is_in(glob, vertices));
113 for (
const auto& srf : surfaces) {
114 auto pbounds =
dynamic_cast<const PlanarBounds*
>(&srf->bounds());
115 for (
const auto& vtx : pbounds->vertices()) {
117 srf->localToGlobal(
gctx, vtx, {}, glob);
119 BOOST_CHECK(is_in(trf.inverse() * glob, vertices));
125 std::array<Vector3D, 8> vertices;
126 vertices = {{{0, 0, 0},
138 std::ofstream os(
"cuboid.ply");
139 os << ply << std::flush;
145 std::array<Vector3D, 8> vertices;
146 vertices = {{{0, 0, 0},
161 BOOST_CHECK_EQUAL(
bb.entity(),
nullptr);
162 BOOST_CHECK_EQUAL(
bb.max(),
Vector3D(2, 1, 1));
163 BOOST_CHECK_EQUAL(
bb.min(),
Vector3D(0., 0., 0.));
167 BOOST_CHECK_EQUAL(bb.entity(),
nullptr);
169 BOOST_CHECK_EQUAL(bb.min(),
Vector3D(0, -1, 0));
173 BOOST_CHECK_EQUAL(bb.entity(),
nullptr);
181 BOOST_CHECK_EQUAL(bb.entity(),
nullptr);
186 BOOST_AUTO_TEST_SUITE_END()