Using the voronoi/delaunay diagram generation library found in this program, which is based on Fortune's original implementation of his algorithm, with a random set of points as input data, I am able to get the following output data:
- A list of the edges from the Delaunay Triangulation, meaning that for each input point, I can see which input points are its neighbors. They don't appear to be in any particular order.
- A list of the vertex pairs from the Voronoi Diagram, which I can use to draw the Voronoi diagram one line at a time. Again, apparently in no particular order.
- An unnamed list of pairs of points, which seems to just be the same list as 2, but in a different order.
- A list of the vertices formed in the Voronoi Diagram, also apparently in no particular order.
Here is an example of data from a test run of my program using this library:
Input points:
0 (426.484, 175.16)
1 (282.004, 231.388)
2 (487.891, 353.996)
3 (50.8574, 5.02996)
4 (602.252, 288.418)
Vertex Pairs:
0 (387.425, 288.533) (277.142, 5.15565)
1 (387.425, 288.533) (503.484, 248.682)
2 (277.142, 5.15565) (0, 288.161)
3 (387.425, 288.533) (272.213, 482)
4 (503.484, 248.682) (637.275, 482)
5 (503.484, 248.682) (642, 33.7153)
6 (277.142, 5.15565) (279.477, 0)
Voronoi lines?:
0 (279.477, 0) (277.142, 5.15565)
1 (642, 33.7153) (503.484, 248.682)
2 (503.484, 248.682) (637.275, 482)
3 (387.425, 288.533) (272.213, 482)
4 (277.142, 5.15565) (0, 288.161)
5 (387.425, 288.533) (503.484, 248.682)
6 (277.142, 5.15565) (387.425, 288.533)
Delaunay Edges:
0 (282.004, 231.388) (487.891, 353.996)
1 (602.252, 288.418) (487.891, 353.996)
2 (426.484, 175.16) (487.891, 353.996)
3 (426.484, 175.16) (602.252, 288.418)
4 (50.8574, 5.02996) (282.004, 231.388)
5 (426.484, 175.16) (282.004, 231.388)
6 (50.8574, 5.02996) (426.484, 175.16)
Vertices:
0 (277.142, 5.15565)
1 (503.484, 248.682)
2 (387.425, 288.533)
3 (0, 288.161)
4 (272.213, 482)
5 (637.275, 482)
6 (642, 33.7153)
7 (279.477, 0)
While the above data is adequate if all I need is to draw the Voronoi and Delaunay diagrams, it is not enough information for the actual work I am trying to do with these diagrams. What I need is a dictionary of polygons formed by the Voronoi vertices, indexed by the input point that each polygon was formed around. Preferably, for each polygon, these points would be sorted in clockwise order.
With the above information, I could implicitly assign data to each region, assign data to corners if necessary, tell which regions share edges (using the Delaunay edges), and do analysis accordingly.
So in short, how can I use the data available to me to put together a dictionary in which the key is one of the input points, and the data indexed by that key is a list of the Voronoi vertices that form the surrounding polygon? Or alternatively, is that information somewhere implicit in the data I've been given?