def test_multipolygon_touching_poly(self): np.random.seed(49) multipolygon = \ Multipolygon([[np.array([[0,0],[3,0],[3,3],[0,3]]) + np.random.randint(-50, 50, (1, 2))] for _ in range(50)]) poly = Polygon([(-30, -40), (12, -30), (8, 22), (-10, 50)]) touching = multipolygon.touching(poly) self.assertEqual(len(touching), 14) return
def test_multipolygon_touching_line(self): np.random.seed(49) multipolygon = \ Multipolygon([[np.array([[0,0],[10,0],[10,10],[0,10]]) + np.random.randint(-50, 50, (1, 2))] for _ in range(50)]) line = Line([(-40, -35), (-15, -30), (30, 5), (10, 32), (-15, 17)]) touching = multipolygon.touching(line) self.assertEqual(len(touching), 10) return