剪裁Voronoi船只(pysal.cg.voronoi)

发布于 2025-01-20 06:11:12 字数 871 浏览 0 评论 0原文

直奔问题:给出这些点

[[ 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

enter image description here

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文