The prompt says:
#264653 #2a9d8f #e9c46a #f4a261 #e76f51, no gradients.
Optionally, you can use a black or white background.
Which isn't super attractive to me, since I want to draw a single-color work on my AxiDraw. So, I didn't interpret the color hexcodes as colors, I interpreted them as unparsed strings. And gradients aren't really a viable thing with a pen drawing - I could do some sort of hatching, which would be interesting, which would approximate a gradient, but I wasn't really up for that. So I did iso-lines of distance functions from the actual letterforms, using marching squares to sample the space.
I first wrote a font for the hex digits (plus octothorpe), which took up a bunch of my time. I designed this font around the shapes that I knew that drawSVG had, including (poly)lines, circular arcs, and circles. And then I cheesed it and just entered the font data using lines and circular arcs - polylines were just a bunch of individual lines, circles were pairs of circular arcs.
I positioned the strings at random places (generativity!) on the canvas, and then traced the signed distance function to the lines and arcs. Actually, I hacked it, and allowed the arcs to pretend to be circles, which made the SDF much simpler. Originally, I had the slanty upright part of my "7" be an arc of a circle, but the center of the circle was way off to the right, and I wasn't going to go through the effort to make it correct, so I re-coded the upright to just be a straight line, which worked fine, and is almost as good.
I sampled the overall SDF for the composition of all the positioned strings on a square lattice, which gave me a nice smooth(ish) function to run marching squares on. My marching squares code is pretty simple and stupid, and just outputs tiny little line segments for each square. I want to revisit it to string together the line segments into paths, which will improve print speed.
One thing that I'm (slowly) learning is to try to feed the AxiDraw stuff in order, so that the pen doesn't have to lift up and move across the paper, and drop down again very often, or the move is short, if it does. So, this does a left-to-right drawing of the little line segments, per iso-line. When I do the path consolidation, this would be substantially faster.
Tools Used: AxiDraw, Pentel 5mm pen, Inigo Quilezles's 2d SDF reference: https://iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm, Wikipedia's page on Marching Squares https://en.wikipedia.org/wiki/Marching_squares
Languages Used: Python
Development Time: ~3 hours
Drawing Time: ~45 minutes
What's Generative Here: The 5 strings from the prompt are randomly positioned on the canvas, and serve as "seeds" that the curves loop around, like ripples on a pond.
No comments:
Post a Comment