本文整理汇总了Python中Polygon.Polygon.get_area方法的典型用法代码示例。如果您正苦于以下问题:Python Polygon.get_area方法的具体用法?Python Polygon.get_area怎么用?Python Polygon.get_area使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Polygon.Polygon
的用法示例。
在下文中一共展示了Polygon.get_area方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from Polygon import Polygon [as 别名]
# 或者: from Polygon.Polygon import get_area [as 别名]
def main():
size = True
n = 0
#pointt = [Point(0, 0), Point(1, 3), Point(1, 2), Point(2, 3), Point(4, 1), Point(5, 1), Point(5, 0)]
pointt = [Point(0, -4), Point(0, 2), Point(-3, -1), Point(3, -1), Point(-1, 0), Point(1, -2), Point(1, 0) , Point(-1, -2)]
point = [Point(0, 5), Point(5, 0), Point(0, -5), Point(-5, 0)]
points = []
counter = 0
control_point = 0
with open('data.txt') as f:
for line in f:
int_list = [float(i) for i in line.split()]
counter += 1
if counter == 1:
n = int_list[0]
control_point = Point(int_list[1],int_list[2])
else:
if counter <= n+1:
points.append(Point(int_list[0],int_list[1]))
#print int_list
# for i in points:
# print(i._x )
# print( i._y)
control_point = Point(2,2)
poly = Polygon(pointt, False)
print(poly.get_area())
print(poly.is_point_belongs(control_point))
print(poly.is_point_belongs_another(control_point))
poly.write_to_file()
return