本文整理匯總了Python中polygon.Polygon.belongs_to_polygon方法的典型用法代碼示例。如果您正苦於以下問題:Python Polygon.belongs_to_polygon方法的具體用法?Python Polygon.belongs_to_polygon怎麽用?Python Polygon.belongs_to_polygon使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類polygon.Polygon
的用法示例。
在下文中一共展示了Polygon.belongs_to_polygon方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_should_retrieve_false_to_a_point_that_is_not_inside_a_polygon
# 需要導入模塊: from polygon import Polygon [as 別名]
# 或者: from polygon.Polygon import belongs_to_polygon [as 別名]
def test_should_retrieve_false_to_a_point_that_is_not_inside_a_polygon(self):
A = [3, 6]; B = [3, 11]; C = [6, 11]; D = [6, 9]; E = [5, 9]; F = [5, 6]
polygon = Polygon([A, B, C, D, E, F])
test_point = [4, 5]
assert_false(polygon.belongs_to_polygon(test_point))
test_point = [6, 7]
assert_false(polygon.belongs_to_polygon(test_point))
示例2: test_should_retrieve_false_to_a_point_outside_a_polygon_that_has_6_sides
# 需要導入模塊: from polygon import Polygon [as 別名]
# 或者: from polygon.Polygon import belongs_to_polygon [as 別名]
def test_should_retrieve_false_to_a_point_outside_a_polygon_that_has_6_sides(self):
A = [2, 1]; B = [2, 5]; C = [4, 5]
D = [4, 8]; E = [6, 8]; F = [6, 1]
polygon = Polygon([A, B, C, D, E, F])
test_point = [2, 8]
assert_false(polygon.belongs_to_polygon(test_point))
示例3: test_should_retrieve_true_to_a_point_that_is_inside_a_more_complex_polygon
# 需要導入模塊: from polygon import Polygon [as 別名]
# 或者: from polygon.Polygon import belongs_to_polygon [as 別名]
def test_should_retrieve_true_to_a_point_that_is_inside_a_more_complex_polygon(self):
A = [1, 2]; B = [1, 4]; C = [3, 4]; D = [3, 6]; E = [5, 6];
F = [5, 4]; G = [7, 4]; H = [7, 6]; I = [9, 6]; J = [9, 2]
polygon = Polygon([A, B, C, D, E, F, G, H, I, J])
test_point = [5, 5]
assert_true(polygon.belongs_to_polygon(test_point))
示例4: is_coordinate_inside_figure
# 需要導入模塊: from polygon import Polygon [as 別名]
# 或者: from polygon.Polygon import belongs_to_polygon [as 別名]
def is_coordinate_inside_figure(self, p):
polygon = Polygon(self.merged_list)
if self.is_coordinate_over_some_line(p):
return True
else:
return polygon.belongs_to_polygon(p)