convex_hull 个几何体
convex_hull of a geometry
我需要获取多边形的 convex_hull。我正在使用匀称。不确定如何应用 convex_hull 来获得我需要的结果:
from shapely.geometry import Polygon
p = Polygon(((0,0),(2,0),(2,2),(0,2),(1,1)))
我需要的结果。我不知道如何获得坐标,包括重复第一个:
In[]: p.convex_hull # How to get the resulted coordinates?
Out[]:
((0,0),(2,0),(2,2),(0,2),(0,0)
试试这个:
from shapely.geometry import Polygon
p = Polygon(((0,0),(2,0),(2,2),(0,2),(1,1)))
x = p.convex_hull
a, b = x.exterior.coords.xy
tuple(list(zip(a,b)))
我需要获取多边形的 convex_hull。我正在使用匀称。不确定如何应用 convex_hull 来获得我需要的结果:
from shapely.geometry import Polygon
p = Polygon(((0,0),(2,0),(2,2),(0,2),(1,1)))
我需要的结果。我不知道如何获得坐标,包括重复第一个:
In[]: p.convex_hull # How to get the resulted coordinates?
Out[]:
((0,0),(2,0),(2,2),(0,2),(0,0)
试试这个:
from shapely.geometry import Polygon
p = Polygon(((0,0),(2,0),(2,2),(0,2),(1,1)))
x = p.convex_hull
a, b = x.exterior.coords.xy
tuple(list(zip(a,b)))