9 #include <boost/test/unit_test.hpp>
26 BOOST_AUTO_TEST_SUITE(Surfaces)
29 std::vector<vec2> vertices;
30 vertices = {{0, 0}, {1, 0}, {0.2, 0.2}, {0, 1}};
31 { BOOST_CHECK_THROW(
poly<4> quad(vertices), std::logic_error); }
33 vertices = {{0, 0}, {1, 0}, {0.8, 0.8}, {0, 1}};
41 vertices = {{0, 0}, {1, 0}, {0.5, 1}, {0.9, 1.2}};
42 { BOOST_CHECK_THROW(
poly<4> quad{vertices}, std::logic_error); }
45 vertices = {{0, 0}, {1, 0}, {0.9, 1.2}, {0.5, 1}};
48 vertices = {{0, 0}, {1, 0}, {0.8, 0.5}, {1, 1}, {0, 1}};
49 { BOOST_CHECK_THROW(
poly<5> pent(vertices), std::logic_error); }
51 vertices = {{0, 0}, {1, 0}, {1.1, 0.5}, {1, 1}, {0, 1}};
56 std::vector<vec2> vertices;
59 vertices = {{0, 0}, {1, 0}, {0.5, 1}};
68 BOOST_CHECK(triangle.
inside({0.2, 0.2}, bc));
69 BOOST_CHECK(!triangle.inside({0.4, 0.9}, bc));
70 BOOST_CHECK(!triangle.inside({0.8, 0.8}, bc));
71 BOOST_CHECK(!triangle.inside({0.3, -0.2}, bc));
79 vertices = {{0, 0}, {1, 0}, {0.9, 1.2}, {0.5, 1}};
82 bb = quad.boundingBox();
86 BOOST_CHECK(quad.inside({0.2, 0.2}, bc));
87 BOOST_CHECK(!quad.inside({0.4, 0.9}, bc));
88 BOOST_CHECK(quad.inside({0.8, 0.8}, bc));
89 BOOST_CHECK(!quad.inside({0.3, -0.2}, bc));
99 std::vector<vec2> vertices = {{0, 0}, {1, 0}, {0.9, 1.2}, {0.5, 1}};
102 auto valvector = original.
values();
103 std::array<double, poly<4>::eSize>
values;
106 BOOST_CHECK_EQUAL(original, recreated);
112 std::vector<vec2> vertices;
115 vertices = {{0, 0}, {1, 0}, {0.5, 1}};
116 poly triangle(vertices);
124 BOOST_CHECK(triangle.
inside({0.2, 0.2}, bc));
125 BOOST_CHECK(!triangle.inside({0.4, 0.9}, bc));
126 BOOST_CHECK(!triangle.inside({0.8, 0.8}, bc));
127 BOOST_CHECK(!triangle.inside({0.3, -0.2}, bc));
135 BOOST_AUTO_TEST_SUITE_END()