예제 #1
0
 def test_polyline_rectangle_intersection_polyline_inside_rectangle(
         self, polyline1):
     rectangle = Rectangle(Vector2(0, 0), Vector2(10, 0), Vector2(0, 10))
     assert polyline1.intersects(rectangle)
     assert rectangle.intersects(polyline1)
예제 #2
0
 def test_polyline_rectangle_no_intersection(self, polyline1):
     rectangle = Rectangle(Vector2(0, 0), Vector2(1, 0), Vector2(0, 1))
     assert not polyline1.intersects(rectangle)
     assert not rectangle.intersects(polyline1)
예제 #3
0
 def test_polyline_rectangle_intersection(self, polyline1):
     rectangle = Rectangle(Vector2(2, 3), Vector2(2.2, 3), Vector2(2, 3.3))
     assert polyline1.intersects(rectangle)
     assert rectangle.intersects(polyline1)
예제 #4
0
 def test_rectangle_rectangle_intersection_fully_inside_other(self):
     rect1 = Rectangle(Vector2(1, 0), Vector2(2, 0), Vector2(1, 1))
     rect2 = Rectangle(Vector2(1.1, 0.1), Vector2(1.2, 0.1),
                       Vector2(1.1, 0.3))
     assert rect1.intersects(rect2)
     assert rect2.intersects(rect1)
예제 #5
0
 def test_rectangle_rectangle_intersection(self):
     rect1 = Rectangle(Vector2(1, 0), Vector2(2, 0), Vector2(1, 1))
     rect2 = Rectangle(Vector2(0.5, 0), Vector2(3, 0), Vector2(0.5, 1))
     assert rect1.intersects(rect2)
     assert rect2.intersects(rect1)
예제 #6
0
 def test_rectangle_circle_intersection_center_not_inside_rect(
         self, unit_circle):
     rect = Rectangle(Vector2(0.8, 0), Vector2(2, 0), Vector2(0.8, 1))
     assert unit_circle.intersects(rect)
     assert rect.intersects(unit_circle)
예제 #7
0
 def test_rectangle_circle_intersection_center_inside_rect(
         self, unit_circle):
     rect = Rectangle(Vector2(-1, -1), Vector2(1, -1), Vector2(-1, 1))
     assert unit_circle.intersects(rect)
     assert rect.intersects(unit_circle)
예제 #8
0
 def test_rectangle_circle_no_intersection(self, unit_circle):
     rect = Rectangle(Vector2(1.1, 0), Vector2(2, 0), Vector2(1.1, 1))
     assert not unit_circle.intersects(rect)
     assert not rect.intersects(unit_circle)