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));
74 vertices = {{0, 0}, {1, 0}, {0.9, 1.2}, {0.5, 1}};
77 bb = quad.boundingBox();
78 BOOST_CHECK_EQUAL(bb.min(),
Vector2D(0, 0));
79 BOOST_CHECK_EQUAL(bb.max(),
Vector2D(1, 1.2));
81 BOOST_CHECK(quad.inside({0.2, 0.2}, bc));
82 BOOST_CHECK(!quad.inside({0.4, 0.9}, bc));
83 BOOST_CHECK(quad.inside({0.8, 0.8}, bc));
84 BOOST_CHECK(!quad.inside({0.3, -0.2}, bc));
89 std::vector<vec2> vertices = {{0, 0}, {1, 0}, {0.9, 1.2}, {0.5, 1}};
92 auto valvector = original.
values();
93 std::array<double, poly<4>::eSize>
values;
96 BOOST_CHECK_EQUAL(original, recreated);
102 std::vector<vec2> vertices;
105 vertices = {{0, 0}, {1, 0}, {0.5, 1}};
106 poly triangle(vertices);
114 BOOST_CHECK(triangle.
inside({0.2, 0.2}, bc));
115 BOOST_CHECK(!triangle.inside({0.4, 0.9}, bc));
116 BOOST_CHECK(!triangle.inside({0.8, 0.8}, bc));
117 BOOST_CHECK(!triangle.inside({0.3, -0.2}, bc));
120 BOOST_AUTO_TEST_SUITE_END()