9 #include <boost/test/unit_test.hpp>
24 class AssertionFailureException;
34 BOOST_AUTO_TEST_SUITE(Surfaces)
38 vertices = {{0, 0}, {1, 0}, {0.2, 0.2}, {0, 1}};
39 { BOOST_CHECK_THROW(
poly<4> quad(vertices), std::logic_error); }
41 vertices = {{0, 0}, {1, 0}, {0.8, 0.8}, {0, 1}};
49 vertices = {{0, 0}, {1, 0}, {0.5, 1}, {0.9, 1.2}};
50 { BOOST_CHECK_THROW(
poly<4> quad{vertices}, std::logic_error); }
53 vertices = {{0, 0}, {1, 0}, {0.9, 1.2}, {0.5, 1}};
56 vertices = {{0, 0}, {1, 0}, {0.8, 0.5}, {1, 1}, {0, 1}};
57 { BOOST_CHECK_THROW(
poly<5> pent(vertices), std::logic_error); }
59 vertices = {{0, 0}, {1, 0}, {1.1, 0.5}, {1, 1}, {0, 1}};
67 vertices = {{0, 0}, {1, 0}, {0.5, 1}};
76 BOOST_CHECK(triangle.
inside({0.2, 0.2}, bc));
77 BOOST_CHECK(!triangle.inside({0.4, 0.9}, bc));
78 BOOST_CHECK(!triangle.inside({0.8, 0.8}, bc));
79 BOOST_CHECK(!triangle.inside({0.3, -0.2}, bc));
82 vertices = {{0, 0}, {1, 0}, {0.9, 1.2}, {0.5, 1}};
85 bb = quad.boundingBox();
86 BOOST_CHECK_EQUAL(bb.min(),
Vector2(0, 0));
87 BOOST_CHECK_EQUAL(bb.max(),
Vector2(1, 1.2));
89 BOOST_CHECK(quad.inside({0.2, 0.2}, bc));
90 BOOST_CHECK(!quad.inside({0.4, 0.9}, bc));
91 BOOST_CHECK(quad.inside({0.8, 0.8}, bc));
92 BOOST_CHECK(!quad.inside({0.3, -0.2}, bc));
97 std::vector<vec2>
vertices = {{0, 0}, {1, 0}, {0.9, 1.2}, {0.5, 1}};
100 auto valvector = original.
values();
101 std::array<double, poly<4>::eSize>
values{};
104 BOOST_CHECK_EQUAL(original, recreated);
113 vertices = {{0, 0}, {1, 0}, {0.5, 1}};
114 poly triangle(vertices);
122 BOOST_CHECK(triangle.
inside({0.2, 0.2}, bc));
123 BOOST_CHECK(!triangle.inside({0.4, 0.9}, bc));
124 BOOST_CHECK(!triangle.inside({0.8, 0.8}, bc));
125 BOOST_CHECK(!triangle.inside({0.3, -0.2}, bc));
128 BOOST_AUTO_TEST_SUITE_END()