如何定期用点填充多边形? [英] How to fill polygon with points regularly?

查看:86
本文介绍了如何定期用点填充多边形?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

填充矩形很简单:只需制作一些网格即可。但是,如果多边形是无条件的,那么任务就变得不那么琐碎了。

可能规则地可以表示为彼此之间的距离为:R±alpha。但是我不确定。

也许有一些已知的算法可以实现这一目标。

已添加:

我需要生成网,其中没有大孔,也没有大的点集。

It is simple to fill rectangle: simply make some grid. But if polygon is unconditioned the task becomes not so trivial.
Probably "regularly" can be formulated as distance between each other point would be: R ± alpha. But I'm not sure about this.
Maybe there is some known algorithm to achieve this.
Added:
I need to generate net, where no large holes, and no big gathering of the points.

推荐答案

您是否想使用点的力导向布局?

Have you though about using a force-directed layout of the points?

在边界上随机散布多个点多边形,然后重复应用两个简单规则来调整其位置:

Scatter a number of points randomly over the bounding box of your polygon, then repeatedly apply two simple rules to adjust their location:


  1. 如果点在多边形之外,请将其移动到

  2. 点之间相互排斥的力与它们之间的距离成反比,即:对于每个多边形,点,考虑每隔一个点,并计算一个排斥向量,它将两个点直接分开。向量对于邻近点应较大,而对于远处点则较小。将向量求和并添加到点的位置。

经过多次迭代,这些点应稳定地分布在一个稳定的状态下在多边形区域上。达到此状态的速度取决于多边形的几何形状以及您如何缩放点之间的排斥力。

After a number of iterations the points should settle into a steady state with an even distribution over the polygon area. How quickly this state is achieved depends on the geometry of the polygon and how you've scaled the repulsive forces between the points.

这篇关于如何定期用点填充多边形?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆