pythonconvex-hulldelaunay

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


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:

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:

enter image description here

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.


Solution

  • 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.