當我比較scipy(0.9.0)和matplotlib(1.0.1)Delaunay三角測量例程時,我注意到一個無法解釋的行爲。我的觀點是存儲在numpy.array([[easting, northing], [easting, northing], [easting, northing]])
中的UTM座標。 Scipy的邊緣缺少我的一些觀點,而matplotlib都在那裏。有沒有修復,或者我做錯了什麼?當附近scipy.spatial.Delaunay
import scipy
import numpy
from scipy.spatial import Delaunay
import matplotlib.delaunay
def delaunay_edges(points):
d = scipy.spatial.Delaunay(points)
s = d.vertices
return numpy.vstack((s[:,:2], s[:,1:], s[:,::-2]))
def delaunay_edges_matplotlib(points):
cens, edges, tri, neig = matplotlib.delaunay.delaunay(points[:,0], points[:,1])
return edges
points = numpy.array([[500000.25, 6220000.25],[500000.5, 6220000.5],[500001.0, 6220001.0],[500002.0, 6220003.0],[500003.0, 6220005.0]])
edges1 = delaunay_edges(points)
edges2 = delaunay_edges_matplotlib(points)
numpy.unique(edges1).shape # Some points missing, presumably nearby ones
numpy.unique(edges2).shape # Includes all points
感謝您的回答,一個很好的解決方案。 – Benjamin