Computer-Generated Circular Art
In place of the regularly scheduled blog about handcrafted woodwork, this week I'll share some details about a recent project in enabling a computer to create "art" automatically. From the recent "Artists That Inspire" post, you may recall my description and admiration of Bruce Shapiro's Sisyphus creation: a robot that draws beautiful geometric patterns in a sand bed embedded inside a coffee table. Before he launched his Kickstarter to make this commercially available, I thought I'd take a stab at creating one myself.
For a sense of what this Sisyphus thing might look like, check out the photos here, or go to Sisyphus-Industries.com.
One of the many pieces I had to develop was software that could automatically generate continuous line circular art.
I developed two types of continuous line drawings: circular mazes, and geometric patterns. Though I no longer have any need to draw this in sand, I can imagine these becoming future wood creations, perhaps as trivets, or as toys. The mazes in particular can be customized, with versions that could stump the most persistent puzzle master, or that would be of interest to those with a little less patience.
I recently dusted off the software in developing a proposal for a mass-customization product for a potential corporate client, and thought I'd share some of the images and puzzles that came out of it.
If you're mathematically inclined or enjoy algorithms, the details below might interest you. Or just take a gander at the images and let me know what you think!
Start at the red dot on the perimeter and end at the center; like any good maze, there is exactly one solution.
Did you have fun trying to find the solution? (If not, you can find the solutions here). Would you find it fun - or maddening - to do that in a toy with a marble?
How to Draw a Maze
These mazes are randomly generated - the only inputs I provide are the outer diameter, the inner diameter, and the number of concentric rings. The logic to create a maze is actually quite simple: you can read about a variety of approaches here. A circular maze only required rethinking the concept of what maze “cells” are adjacent to each other.
Astute readers may wonder if there isn’t a fourth input, how many cells are in each ring, or at least, how many cells are in one particular ring? While this could be an input, I decided instead to define this somewhat algorithmically, so that the cells in that innermost ring are roughly squarish, and that there are a power of four cells (i.e.: 4, 8, 16, ....). I'll skip over the geometric details of this, but it goes back to highschool geometry and trigonometry, secants and radii and the like.
Then as you go to outer rings, as the growing circumference means you can squeeze more squarish cells into that ring, the number of cells periodically doubles. Note that the fact that outer rings can have more cells than an adjacent inner ring makes tracking cell adjacencies for the maze algorithm a little more interesting, though it doesn't change the underlying approach.
These patterns are also randomly generated. Would this make an interesting trivet or decorative wall hanging that you might enjoy?
These are created in one of two ways. The pattern on the left is created by starting with a simple polygon, like a hexagon. But rather than simply drawing it, each of the lines is rotated slowly and with a pen that gradually drifts outward, so that that shape is "fully" drawn, it's actually left slightly open. Then the the next hexagon starts where the last one left off, but repeats those same transformations, so it's rotated slightly more, and slightly larger.
The pattern on the right is slightly more complicated: imagine a spiral, but then, instead of drawing it with a straight line, draw it with a repeating geometric pattern, such as part of triangle. In both cases, the pattern is random: the simple shape to start from, how tightly packed the spiral or rotating shape is, etc. And so you have an infinite array of geometric patterns.
Drawing with Two Pens
Because these were intended for a polar plotter, that plotter could actually have a pen on each side of the arm, drawing with two pens simultaneously, allowing for an even greater range and complexity of patterns. In each of these triplets of pictures, there’s the single pen version as above, and then two multi-pen versions. The second pen is drawn in red. Can you figure out the pattern relating each of the two multi-pen versions?
If you imagine a polar plotter with a pen on each side, the second pen can be mechanically joined to the first pen in one of two ways:
- Both pens could keep the same distance from the center, so that when the black pen is near the center, the red pen is also near the center but on the opposite side; or
- Both pens could be a fixed distance from each other, so that while the black pen is at the center, the red pen is at the outer edge.
Think any of these patterns would make interesting projects? Or have your own randomized drawing approach to share? I'd love to hear about it from you.