本文整理汇总了Python中Polygon.makeConvexHull方法的典型用法代码示例。如果您正苦于以下问题:Python Polygon.makeConvexHull方法的具体用法?Python Polygon.makeConvexHull怎么用?Python Polygon.makeConvexHull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Polygon
的用法示例。
在下文中一共展示了Polygon.makeConvexHull方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ConvexHull
# 需要导入模块: import Polygon [as 别名]
# 或者: from Polygon import makeConvexHull [as 别名]
if __name__ == '__main__':
'''
# Convex hull
points = np.random.rand(30, 2)
hull = ConvexHull(points)
convexHullArray=[]
for j in hull.vertices:
convexHullArray.append([points[j,0], points[j,1]])
print convexHullArray
print convexHullArray[1]
'''
points = np.random.rand(30,2)
convexhull = poly.makeConvexHull(points)
print convexhull
'''
print(type(points))
plt.plot(points[:,0], points[:,1], 'o')
for simplex in hull.simplices:
plt.plot(points[simplex,0], points[simplex,1], 'k-')
plt.plot(points[hull.vertices,0], points[hull.vertices,1], 'r--', lw=2)
plt.plot(points[hull.vertices[0],0], points
[hull.vertices[0],1], 'ro')
plt.show()
'''
# Read shapefile
shp = pysal.pysal.core.FileIO.FileIO.open('testdata/cities.shp','r') # @UndefinedVariable
shp.seek(0)