"Random Regional Racetracks"
I wanted to do something quick today, and it didn't turn out quite as quick as I intended. I had wanted to do something based on the loop of a racetrack, and I had some algorithmic ideas in the back of my head that I wanted to try out.
So, first, I generated a Bridson blue noise grid, of course. I used scipy's Voronoi package to generate Voronoi regions for each of the points. I then did some data structure munging to build a way of knowing what regions neighbor each other.
Then, I used this neighbor table to generate paths of connected regions that looped back to their beginning within a given window of path lengths. Each time I found a loop, I stored that, and made subsequent length windows smaller, until I got an empty path for my query. (Not that I couldn't make more paths, clearly I could, just that particular query started from a point that led to a dead end.)
For each list of regions, I drew a path, using a cubic bezier curve to round out the edges, and letting drawSVG close the curves for me.
Looking at the raster(color) version, they look more like lakes than they look like racetracks - I would like to fatten up the paths, which wouldn't be too hard to do, just offset left and right perpendicular to the track path segments.
Another thing I got around to doing was to add a sorted draw path function to my edgepool class, so the Voronoi grid drew mostly left to right.
Tools Used: AxiDraw, Pentel .5mm pen
Languages Used: Python
Development Time: ~2 hours
Drawing Time: ~5 minutes
What's Generative Here: I start with a random blue noise point set, generate the voronoi graph for those points, and then trace closed paths on those voronoi cells.
No comments:
Post a Comment