def test_poly_intersection(self): # test polygons formed exactly as in test_line_intersection2, except # the rings are implicitly closed # ----- # | --x-- # | . . | # --x-- | # ----- poly0 = Polygon([(0.0, 0.0), (3.0, 0.0), (3.0, 3.0), (0.0, 3.0)]) poly1 = Polygon([(1.0, 4.0), (-2.0, 4.0), (-2.0, 1.0), (1.0, 1.0)]) self.assertTrue(poly0.intersects(poly1)) self.assertEqual(poly0.intersections(poly1), Multipoint([(0.0, 1.0), (1.0, 3.0)])) return
def test_intersection_polygons(self): poly0 = Polygon([(0, 0), (2, 0), (3, 1), (2, 1), (2, 2), (1, 0)]) poly1 = Polygon([(-1, -1), (1, -1), (1, 1), (-1, 1)]) self.assertTrue(poly0.intersects(poly1)) return