我有一個點,我試圖在python中生成凸層的列表。從一組點創建凸層的Efficent算法
目前我只是使用下列內容:
def convex_layers(points):
points = sorted(set(points))
layers = []
while points:
#Create the next convex hull
hull = convex_hull(points)
#Create the new list of points
for point in hull:
points.remove(point)
#Update the list of layers
layers.append(hull)
return layers
這僅僅是創建凸包一次一個。雖然它起作用,但看起來很像試圖通過重複添加來繁殖。所以我問的是,如果有一個更有效的算法專門用於從一組點創建凸層
有趣的是,我認爲可能是大約10分鐘前的事情。所以你說的是目前正在做的事情。所以也許它已經運行得儘可能好。更新了帖子反映了這一點。 – Nuclearman
那麼好吧,接受我的答案可能是適當的。謝謝。 – Gene
夠正確。儘管仍然認爲應該有一種方法來提高效率,避免必須繼續貫穿每一層的所有剩餘點。仍然可能不會有很大的改進。 – Nuclearman