| 6 | using namespace Star; |
| 7 | |
| 8 | TEST(PolyTest, ConvexHull) { |
| 9 | PolyF::VertexList inputVertexes; |
| 10 | for (unsigned i = 0; i < 1000; ++i) { |
| 11 | float angle = Random::randf() * 2 * Constants::pi; |
| 12 | inputVertexes.append({sin(angle), cos(angle)}); |
| 13 | } |
| 14 | |
| 15 | PolyF convex = PolyF::convexHull(inputVertexes); |
| 16 | |
| 17 | PolyF::VertexList testVertexes; |
| 18 | for (unsigned i = 0; i < 1000; ++i) { |
| 19 | float angle = Random::randf() * 2 * Constants::pi; |
| 20 | testVertexes.append({sin(angle) * 0.75f, cos(angle) * 0.75f}); |
| 21 | } |
| 22 | |
| 23 | for (auto const& vertex : testVertexes) |
| 24 | EXPECT_TRUE(convex.contains(vertex * 0.75f)); |
| 25 | } |
| 26 | |
| 27 | TEST(PolyTest, Distance) { |
| 28 | PolyF square = {{-1.0f, -1.0f}, {1.0f, -1.0f}, {1.0f, 1.0f}, {-1.0f, 1.0f}}; |
nothing calls this directly
no test coverage detected