I’m getting married in a few weeks, and one of the final tasks was to make some favors for the guests. Heather and I decided on coffee mugs with a cute logo. We quickly came up with the concept of a heart with gears inside, as we’re having a steampunk/victorian themed wedding. After one very frustrating evening with the gimp (which ended in a crash before I saved the file), I decided attempt two would be procedural, so I fired up my trusty REPL and vecto:
I seriously considered how to calculate the gear size, teeth, and rotation so they mesh perfectly, then gave up and specified them manually via guess-and-check. The code is at http://paste.lisp.org/display/71465.
I was pretty happy, it ended up being one evening of hacking, with much of that taken rendering test images to get gear placement, rotation, and teeth correct. I was able to get everything drawing in terms of one variable *r*, so I could scale the size of everything simply. In retrospect, that could probably have been done just as easily using vecto:scale. I used vecto:with-graphics-state more than I have before, and that made the drawing operations very straightforward.
I got a little optimistic with the gear-internal generic method, I thought to make many different styles for the inside of the gear, but ended up with only solid and spoked varieties, so had only one specialization for the generic method.
The internal shape of the gear (the number of spokes, or if it’s solid) was determined randomly, and I wrote a quick make-samples function to generate a batch of images. Then I reviewed those with the fiancee to find a random arrangement we liked.
To pick a suitable font I found all the .ttf files on my computer, then looped through those to make a test logo for each font (the test-font function). This proved pointless, as Heather knows her fonts and picked one from memory while I was scrolling through hundreds of png files.
The logo is off at the mug printers, and I should be getting a test mug in the mail this week. Hopefully it will work out and I can offer secret alien technology to all my wedding guests.
5 Comments