Exemplo n.º 1
0
 def test_line_intersection2(self):
     # test lines that have overlapping bounding boxes, but don't cross
     #   -----
     #   | -----
     #   |     |
     #   ----- |
     #     -----
     line0 = Line([(0.0, 0.0), (3.0, 0.0), (3.0, 3.0), (0.0, 3.0)])
     line1 = Line([(1.0, 4.0), (-2.0, 4.0), (-2.0, 1.0), (1.0, 1.0)])
     self.assertFalse(line0.intersects(line1))
     return
Exemplo n.º 2
0
 def test_line_intersection2(self):
     # test lines that have overlapping bounding boxes, but don't cross
     #   -----
     #   | -----
     #   |     |
     #   ----- |
     #     -----
     line0 = Line([(0.0, 0.0), (3.0, 0.0), (3.0, 3.0), (0.0, 3.0)])
     line1 = Line([(1.0, 4.0), (-2.0, 4.0), (-2.0, 1.0), (1.0, 1.0)])
     self.assertFalse(line0.intersects(line1))
     return
Exemplo n.º 3
0
 def test_line_intersection_vertical(self):
     line0 = Line([(2.5, 2.5), (2.5, -2.5)])
     line1 = Line([(1.5, 2.5), (3.5, -2.5)])
     self.assertTrue(line0.intersects(line1))
     self.assertEqual(line0.intersections(line1), Multipoint([(2.5, 0.0)]))
     return
Exemplo n.º 4
0
 def test_line_intersection_horizontal(self):
     line0 = Line([(-2.5, 2.5), (2.5, 2.5)])
     line1 = Line([(0.0, 0.0), (1.0, 5.0)])
     self.assertTrue(line0.intersects(line1))
     self.assertEqual(line0.intersections(line1), Multipoint([(0.5, 2.5)]))
     return
Exemplo n.º 5
0
 def test_line_intersection(self):
     line0 = Line([(0.0, 0.0), (3.0, 3.0)])
     line1 = Line([(0.0, 3.0), (3.0, 0.0)])
     self.assertTrue(line0.intersects(line1))
     self.assertEqual(line0.intersections(line1), Multipoint([(1.5, 1.5)]))
     return
Exemplo n.º 6
0
 def test_line_intersects_geographical2(self):
     line1 = Line([(-40.0, 36.0), (-38.0, 36.5)], crs=SphericalEarth)
     line2 = Line([(-42.0, 34.0), (-41.0, 37.5)], crs=SphericalEarth)
     self.assertFalse(line1.intersects(line2))
     return
Exemplo n.º 7
0
 def test_line_intersection_vertical(self):
     line0 = Line([(2.5, 2.5), (2.5, -2.5)])
     line1 = Line([(1.5, 2.5), (3.5, -2.5)])
     self.assertTrue(line0.intersects(line1))
     self.assertEqual(line0.intersections(line1), Multipoint([(2.5, 0.0)]))
     return
Exemplo n.º 8
0
 def test_line_intersection_horizontal(self):
     line0 = Line([(-2.5, 2.5), (2.5, 2.5)])
     line1 = Line([(0.0, 0.0), (1.0, 5.0)])
     self.assertTrue(line0.intersects(line1))
     self.assertEqual(line0.intersections(line1), Multipoint([(0.5, 2.5)]))
     return
Exemplo n.º 9
0
 def test_line_intersection(self):
     line0 = Line([(0.0, 0.0), (3.0, 3.0)])
     line1 = Line([(0.0, 3.0), (3.0, 0.0)])
     self.assertTrue(line0.intersects(line1))
     self.assertEqual(line0.intersections(line1), Multipoint([(1.5, 1.5)]))
     return
Exemplo n.º 10
0
 def test_line_intersects_geographical4(self):
     # catches possible bugs in handling vertical segments on sweepline
     line1 = Line([(-50.0, 70.0), (50.0, 70.0)], crs=SphericalEarth)
     line2 = Line([(0.0, 71.0), (0.0, 89.0)], crs=SphericalEarth)
     self.assertTrue(line1.intersects(line2))
     return
Exemplo n.º 11
0
 def test_line_intersects_geographical4(self):
     # checks that coordinates are normalized
     line1 = Line([(-10.0, 20.0), (-30.0, 20.0)], crs=SphericalEarth)
     line2 = Line([(340.0, 10.0), (340.0, 30.0)], crs=SphericalEarth)
     self.assertTrue(line1.intersects(line2))
     return
Exemplo n.º 12
0
 def test_line_intersects_geographical3(self):
     # checks to make sure geodesics are handled
     line1 = Line([(-50.0, 70.0), (50.0, 70.0)], crs=SphericalEarth)
     line2 = Line([(0.0, 71.0), (1.0, 89.0)], crs=SphericalEarth)
     self.assertTrue(line1.intersects(line2))
     return
Exemplo n.º 13
0
 def test_line_intersects_geographical2(self):
     line1 = Line([(-40.0, 36.0), (-38.0, 36.5)], crs=SphericalEarth)
     line2 = Line([(-42.0, 34.0), (-41.0, 37.5)], crs=SphericalEarth)
     self.assertFalse(line1.intersects(line2))
     return
Exemplo n.º 14
0
 def test_line_intersects_geographical4(self):
     # checks that coordinates are normalized
     line1 = Line([(-10.0, 20.0), (-30.0, 20.0)], crs=SphericalEarth)
     line2 = Line([(340.0, 10.0), (340.0, 30.0)], crs=SphericalEarth)
     self.assertTrue(line1.intersects(line2))
     return
Exemplo n.º 15
0
 def test_line_intersects_geographical4(self):
     # catches possible bugs in handling vertical segments on sweepline
     line1 = Line([(-50.0, 70.0), (50.0, 70.0)], crs=SphericalEarth)
     line2 = Line([(0.0, 71.0), (0.0, 89.0)], crs=SphericalEarth)
     self.assertTrue(line1.intersects(line2))
     return
Exemplo n.º 16
0
 def test_line_intersects_geographical3(self):
     # checks to make sure geodesics are handled
     line1 = Line([(-50.0, 70.0), (50.0, 70.0)], crs=SphericalEarth)
     line2 = Line([(0.0, 71.0), (1.0, 89.0)], crs=SphericalEarth)
     self.assertTrue(line1.intersects(line2))
     return