确定一个圆是否可以“逃离”一组点。

huangapple go评论69阅读模式
英文:

Finding out if a circle can "escape" a set of points

问题

我试图创建一个程序,用于标记圆是否可以用于以后的计算。要求使用圆的条件是:

  • 点(图中的金点)不能在圆的周围。
  • 圆必须能够“逃离”周围的点,例如,它不能处于封闭空间中。

第一个要求很容易解决,但我对第二个要求有些困惑。

我在Python 3.x中编写代码,并使用DT = scipy.spatial.delaunay(golden_spots)marked_circles = DT.find_simplex(circle_centers)作为标记圆的初始方法,如下图所示(为了方便查看,绘制了凸包),但它还标记了每个图中的两个圆(左图中的所有红圆和右图中最左和最右的红圆),它们能够“逃离”,但在德劳内三角剖分内。问题在于,我仍然希望标记右图中的内部红圆,而不标记外部两个。

就我可用的数据而言,我有所有点和圆心的x/y坐标以及它们的半径(在给定图中所有圆的半径相同)。此外,圆圈在x轴和y轴上的间距不均匀。

图例说明:

  • 灰色圆:未标记
  • 蓝色圆:由于德劳内而标记
  • 绿色圆:由于接近点而标记
  • 红色圆:由于德劳内而标记,但不靠近点

问题:有没有办法不标记最外层的圆,同时仍然标记最内层的圆(右图)?提前感谢。

注意:这两个图仅为示例,但从理论上讲,可能会在图的各个位置有各自的金点,不一定在中间形成一个连续的“堆叠”。

英文:

Simplified explanation: I am trying to create a program that marks whether or not circles can be used for a later calculation. Requirements for a circle to be used:

  • A dot (golden points in the plots) must not be within a circle's circumference
  • The circle must be able to "escape" the surrounding dots, e.g. it must not be in an enclosed space.

The first requirement is easy to solve but i am struggling a bit with the second one.

I am coding in python3.x and have used DT = scipy.spatial.delaunay(golden_spots) and marked_circles = DT.find_simplex(circle_centers) as an initial way to mark circles as can be seen in the picture below (convex hull is plotted to ease visibility), however it also marks two circles in each plot (all red circles in left plot and the left- and right-most red circles in right plot) that would be able to "escape" but are within the delaunay triangulation. The problem here is that i still want the inner red circle in the right plot to be marked, without the outer two.

In terms of what data i have available, then i have the x/y coordinates of all points and circle centers and their radius (all circles have the same radius in a given plot).
Furthermore, the circles are not evenly spaced along the x- and y-axes.

Figure explanation:

  • Grey circles: Unmarked
  • Blue circles: Marked due to delaunay
  • Green circles: Marked due to proximity to point
  • Red circles: Marked due to delaunay but not in proximity of a point

确定一个圆是否可以“逃离”一组点。

Question: Is there a way to not mark the outermost circles while the innermost (right plot) is still marked. Thanks in advance.

Note: These two plots are just examples, but in theory there could be individual golden spots in various places on the plot, not necessarily in one contiguous "pile" in the middle.

答案1

得分: 1

潜在的解决方案可能如下所示:

  1. 消除所有包含金点(蓝/绿色)的圆。

  2. 在所有距离小于d的金点之间绘制线,其中d是圆的直径。

  3. 对于每个剩余的圆,确定该点是否位于由四周的边界包围的区域内。实现这个可能有几种方法:从空间的Delaunay三角剖分创建图,其中每个三角形空间由3个金点连接在一起,如果它们相邻但不在边上(即共享点之间的距离大于d),则它们彼此连接。从所有外部Delaunay三角形到汇点/端点创建边。然后,如果存在从圆的起始Delaunay三角形到汇点的路径,圆应该被涂成绿色。

  4. 另一种方法:通过从凸包开始,然后迭代地“缩小”凸包,使凸包中包含没有通过边连接的两个连续点的地方(即,如果凸包包含两点距离大于d,则添加额外的点到凹凸包,直到所有点距离小于d)。最终的凹凸包将包含所有红色圆的中心,并且不会包含任何灰色圆的中心。

英文:

One potential solution could look like this:

  1. Eliminate all circles that contain a gold point (blue/green I think)

  2. Draw lines between all gold points less than d apart, where d is the diameter of the circles.

  3. For each remaining circle, determine whether that point lies within an area enclosed by edges on all sides. A few possible ways to do this might be: Create a graph from the delaunay triangulation of the space, where each triangular space between 3 gold points is connected to another if they are adjacent along a non-edge (i.e. the distance between the shared points is greater than d). Make an edge from all exterior delaunay triangles to the sink / endpoint. Then, the circle should be colored green iff there exists a path from the circle's starting delaunay triangle to the sink.

  4. An alternative method: create a concave hull by starting with the convex hull, then iteratively "shrinking" the hull everywhere the hull contains two consecutive points not connected by an edge (i.e. if the hull contains two points greater than d apart, add additional points to the concave hull until all points are less than d apart.) The final concave hull will contain the centers of all red circles, and will not contain the centers of any grey circles.

huangapple
  • 本文由 发表于 2023年2月23日 23:43:23
  • 转载请务必保留本文链接:https://go.coder-hub.com/75547114.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定