Sunday, November 9, 2008

Vectorizing



It kept bugging me that my Voronoi code didn't return anything but an image to double check, so I figured a way to go ahead and make it output SVG format paths. I also added some routines to help further simplify the paths, though the output still seems a bit rough. And it was a good thing to check my results, because the simple lengthening of segments somehow resulted in gaps in the path, the sort of thing that would ruin a circuit board. For now I just commented that part out and substituted code that checks if a line is trending in a direction, and then double checked against the error (measured as the sum of the distances from the proposed line to the pixels that would be removed).

I suppose that using Haskell for this might seem like an odd choice, but I'm more familiar with it than Python. The SVG image in this post should show up fine in Firefox. If your browser has trouble with it I'm sure you can Google around an get SVGs to display.
Vornoi.hs

No comments: