本文整理匯總了Python中polygon.Polygon.sample方法的典型用法代碼示例。如果您正苦於以下問題:Python Polygon.sample方法的具體用法?Python Polygon.sample怎麽用?Python Polygon.sample使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類polygon.Polygon
的用法示例。
在下文中一共展示了Polygon.sample方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: sigma_format
# 需要導入模塊: from polygon import Polygon [as 別名]
# 或者: from polygon.Polygon import sample [as 別名]
if not h5file.root.__contains__(sigma_format(sigma)):
sigma_group = h5file.createGroup(h5file.root, sigma_format(sigma))
else:
sigma_group = h5file.root._v_children[sigma_format(sigma)]
for sides in range(3, 8):
if not sigma_group.__contains__(sides_format(sides)):
sides_group = h5file.createGroup(sigma_group, sides_format(sides))
else:
sides_group = sigma_group._v_children[sides_format(sides)]
for i in range(polygons_per_setting):
poly_group = h5file.createGroup(sides_group, '%03d' %i)
poly_group._v_attrs.sigma = sigma
poly_group._v_attrs.num_sides = sides
table = h5file.createTable(poly_group,'sensor_data',Point2D)
p = Polygon(num_sides = sides, regular = False)
data = p.sample(400, sigma = sigma)
row = table.row
for point in data:
row['x'] = point[0]
row['y'] = point[1]
row.append()
table.flush()
corners_table = h5file.createTable(poly_group,'real_corners',Point2D)
row = corners_table.row
for point in p.corners:
row['x'] = point[0]
row['y'] = point[1]
row.append()
corners_table.flush()