| 5 | using namespace Star; |
| 6 | |
| 7 | TEST(LineTest, IntersectionEndpoint) { |
| 8 | Line2F a({0, 0}, {10, 10}); |
| 9 | Line2F b({10, -10}, {0, 0}); |
| 10 | |
| 11 | auto intersection1 = a.intersection(b); |
| 12 | auto intersection2 = b.intersection(a); |
| 13 | |
| 14 | EXPECT_TRUE(intersection1.intersects); |
| 15 | EXPECT_TRUE(intersection2.intersects); |
| 16 | |
| 17 | EXPECT_TRUE(vmag(intersection1.point - Vec2F(0, 0)) < 0.0001f); |
| 18 | EXPECT_TRUE(vmag(intersection2.point - Vec2F(0, 0)) < 0.0001f); |
| 19 | |
| 20 | EXPECT_TRUE(intersection1.glances); |
| 21 | EXPECT_TRUE(intersection2.glances); |
| 22 | |
| 23 | EXPECT_FALSE(intersection1.coincides); |
| 24 | EXPECT_FALSE(intersection2.coincides); |
| 25 | } |
| 26 | |
| 27 | TEST(LineTest, IntersectionMiddle) { |
| 28 | Line2F a({-5, 0}, {5, 0}); |
nothing calls this directly
no test coverage detected