|
|
@@ -254,14 +254,19 @@ TEST(TriangleTest, TriangleIntersectsSelf) {
|
|
|
|
|
|
TEST(TriangleTest, DoesNotIntersectOffset) {
|
|
|
triangle lhs{{{0, 0}}, {{0, 1}}, {{1, 0}}};
|
|
|
- triangle rhs{{{-1, -1}}, {{-1, 0}}, {{0, -1}}};
|
|
|
- EXPECT_FALSE(math::intersects(lhs, rhs));
|
|
|
-}
|
|
|
-
|
|
|
-TEST(TriangleTest, DoesNotIntersectOffset2) {
|
|
|
- triangle lhs{{{0, 0}}, {{0, 1}}, {{1, 0}}};
|
|
|
- triangle rhs{{{1, 1}}, {{1, 2}}, {{2, 1}}};
|
|
|
- EXPECT_FALSE(math::intersects(lhs, rhs));
|
|
|
+ auto tri = [](math::dim2::point const & pt) {
|
|
|
+ return triangle{pt, pt, pt};
|
|
|
+ };
|
|
|
+ math::dim2::point const clock_ab{{1, 1}};
|
|
|
+ math::dim2::point const clock_bc{{-1, -1}};
|
|
|
+ math::dim2::point const clock_ca{{-1, 2}};
|
|
|
+
|
|
|
+ EXPECT_FALSE(math::intersects(lhs, tri(clock_ab)));
|
|
|
+ EXPECT_FALSE(math::intersects(tri(clock_ab), lhs));
|
|
|
+ EXPECT_FALSE(math::intersects(lhs, tri(clock_bc)));
|
|
|
+ EXPECT_FALSE(math::intersects(tri(clock_bc), lhs));
|
|
|
+ EXPECT_FALSE(math::intersects(lhs, tri(clock_ca)));
|
|
|
+ EXPECT_FALSE(math::intersects(tri(clock_ca), lhs));
|
|
|
}
|
|
|
|
|
|
TEST(RotateTest, RotatingSquareAroundOrigin) {
|