剪裁Voronoi船只(pysal.cg.voronoi)
直奔问题:给出这些点
[[ 77.51 254.19], [ 75.32 184.45], [ 88.57 83.43], [153. 135.], [196.62 55.78]]
和一个定义边界框的多边形,该边界框应完全被 voronoi 镶嵌块覆盖:[230 0; 230 370; 0 370; 0 0; 230 0]
我使用此代码执行 Voronoi 曲面细分:
from libpysal.cg.voronoi import voronoi, voronoi_frames
points = np.array(self.__get_coordinates())
bb = box(self.min_x, self.min_y, self.max_x, self.max_y)
region_df, point_df = voronoi_frames(points, clip=bb)
fig, ax = plt.subplots()
plt.plot(*bb.exterior.xy,lw=3)
region_df.plot(ax=ax, color='white', edgecolor='black', lw=3)
point_df.plot(ax=ax, color='red')
其中 min_x=0,min_y=0,max_x=230,max_y=370。不幸的是我得到了这个结果
这是不正确的,因为上面的多边形没有覆盖边界框的其余部分。
知道如何解决这个问题吗?
谢谢 :)
straight to the problem: given these points
[[ 77.51 254.19], [ 75.32 184.45], [ 88.57 83.43], [153. 135. ], [196.62 55.78]]
and a polygon that defines the bounding box, which should be covered entirely by voronoi tessels: [230 0; 230 370; 0 370; 0 0; 230 0]
I use this code to perform Voronoi tessellation:
from libpysal.cg.voronoi import voronoi, voronoi_frames
points = np.array(self.__get_coordinates())
bb = box(self.min_x, self.min_y, self.max_x, self.max_y)
region_df, point_df = voronoi_frames(points, clip=bb)
fig, ax = plt.subplots()
plt.plot(*bb.exterior.xy,lw=3)
region_df.plot(ax=ax, color='white', edgecolor='black', lw=3)
point_df.plot(ax=ax, color='red')
where min_x=0,min_y=0,max_x=230,max_y=370. Unfortunately I obtain this result
which is not correct as the upper polygon do not cover the remaining part of the bounding box.
Any idea on how to fix this?
Thanks :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论