A: 

Wow. I'm going to go out on a limb here and suggest that maybe the algorithm is confused about the inside vs. the outside of the polygon. When you define the edges and vertices of your original polygon, you have to make sure they're defined in such a way that "inside" is always found using something like the "right hand rule". Just looking at the polygon in the bottom right corner, it looks like the edge of your polygon actually crosses itself. Maybe the algorithm is seeing that section, and others, as "inside out". The same in the bottom left.

That's my gut feeling, that the algorithm doesn't seem to be able to determine what direction is inside and what is outside.

I think a naive approach would be to filter out all Voroni "nodes" that are outside the polygon, however, I don't think that will look. Taking a closer look at your diagram, it looks like each node has 3 edges that connect it to other nodes. Perhaps you can filter out nodes where any of the 3 edges are connected to nodes outside the polygon. Would that work?

Scott Whitlock
Indeed. The generated voronoi set is defined both inside and outside the polygon. (For that matter, the voronoi set algorithm does not require that the generating set be a polygon, or even be a continuous connected set.) The original poster is only interested in the boundaries of the voronoi set regions such that those boundaries are inside the poly. So build an algorithm that filters out voronoi set boundaries that are not inside the poly. Determining whether a given point is inside a poly is not very hard.
Eric Lippert
+2  A: 
balint.miklos
A: 

A similar construct is the Straight skeleton, which can be constructed by shrinking the polygon into itself and tracing the vertices as they approach the center. This may be a little easier to construct, though it's not quite the same curve as the medial axis.

TokenMacGuy