当我比较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