我想在我的程序中使用以下函数:
def computeVoronoiDiagram(points):
""" Takes a list of point objects (which must have x and y fields).
Returns a 3-tuple of:
(1) a list of 2-tuples, which are the x,y coordinates of the
Voronoi diagram vertices
(2) a list of 3-tuples (a,b,c) which are the equations of the
lines in the Voronoi diagram: a*x + b*y = c
(3) a list of 3-tuples, (l, v1, v2) representing edges of the
Voronoi diagram. l is the index of the line, v1 and v2 are
the indices of the vetices at the end of the edge. If
v1 or v2 is -1, the line extends to infinity.
"""
siteList = SiteList(points)
context = Context()
voronoi(siteList,context)
return (context.vertices,context.lines,context.edges)
它说获取点对象列表(具有 x 和 y 字段)。它与 Python 列表数据结构不同吗?如何创建这样的对象?编辑:我应该提到列表将包含大约百万个随机点。