本文整理匯總了Python中Polygon.Polygon.write_to_file方法的典型用法代碼示例。如果您正苦於以下問題:Python Polygon.write_to_file方法的具體用法?Python Polygon.write_to_file怎麽用?Python Polygon.write_to_file使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Polygon.Polygon
的用法示例。
在下文中一共展示了Polygon.write_to_file方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: main
# 需要導入模塊: from Polygon import Polygon [as 別名]
# 或者: from Polygon.Polygon import write_to_file [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