Exemplo n.º 1
0
 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
Exemplo n.º 2
0
 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
Exemplo n.º 3
0
 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
Exemplo n.º 4
0
 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