本文整理汇总了Python中karta.vector.geometry.Line.intersects方法的典型用法代码示例。如果您正苦于以下问题:Python Line.intersects方法的具体用法?Python Line.intersects怎么用?Python Line.intersects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类karta.vector.geometry.Line
的用法示例。
在下文中一共展示了Line.intersects方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_line_intersection2
# 需要导入模块: from karta.vector.geometry import Line [as 别名]
# 或者: from karta.vector.geometry.Line import intersects [as 别名]
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
示例2: test_line_intersection_vertical
# 需要导入模块: from karta.vector.geometry import Line [as 别名]
# 或者: from karta.vector.geometry.Line import intersects [as 别名]
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
示例3: test_line_intersection_horizontal
# 需要导入模块: from karta.vector.geometry import Line [as 别名]
# 或者: from karta.vector.geometry.Line import intersects [as 别名]
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
示例4: test_line_intersection
# 需要导入模块: from karta.vector.geometry import Line [as 别名]
# 或者: from karta.vector.geometry.Line import intersects [as 别名]
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
示例5: test_line_intersects_geographical4
# 需要导入模块: from karta.vector.geometry import Line [as 别名]
# 或者: from karta.vector.geometry.Line import intersects [as 别名]
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
示例6: test_line_intersects_geographical3
# 需要导入模块: from karta.vector.geometry import Line [as 别名]
# 或者: from karta.vector.geometry.Line import intersects [as 别名]
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
示例7: test_line_intersects_geographical2
# 需要导入模块: from karta.vector.geometry import Line [as 别名]
# 或者: from karta.vector.geometry.Line import intersects [as 别名]
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