Jacob,
Hey, you found an interesting way to generate this Voronoi diagram, although it is not so efficient.
A less important question in the first place: the different boundaries of the borders that you get, these forms of butterflies, are actually the area between the two branches of the hyperbola. It is the hyperbola given by the equation | da - db | = 4. To get a thick line instead, you must change this criterion and replace it with the distance to the bisector of the two nearest neighbors, let A and B; using vector calculus, | PA.AB / || AB || - || AB || / 2 | <4.
More important issue: there are two well-known effective solutions for constructing a Voronoi diagram for many points: the Fortune sweep algorithm (as mentioned by templatetypedef) and the Preptata and Shamos Divide and Conquer solutions. Both work at the optimal time O (N.Lg (N)) for N points, but they are not so simple to implement.
This algorithm constructs a Voronoi diagram as a set of segments and half-straight lines. Check out http://en.wikipedia.org/wiki/Voronoi_diagram .
This article, “Primitives for Manipulating Common Units and Voronoi’s Computing,” describes both algorithms using a somewhat higher-level structure, taking care of all the implementation details; the article is complicated, but the algorithms are feasible.
You can also take a look at the “simple iterative algorithm for the Voronoi planar diagram”, which I have never tried.
A completely different approach is to directly construct a distance map from these points, for example, using the Dijkstra algorithm: starting from these points, you increase the boundary of the region at a given distance from each point and stop growing when two boundaries meet. [More explanation required.] See http://1.bp.blogspot.com/-O6rXggLa9fE/TnAwz4f9hXI/AAAAAAAAAPk/0vrqEKRPVIw/s1600/distmap-20-seed4-fin.jpg
Another good starting point (for efficiently calculating distance maps) could be the "General Algorithm for Calculating Distance in Linear Time."
source share