I have no idea if someone else has already invented this particular fractal curve or not, but I haven’t found any references to it when I went looking. Then again, I’m not sure what it would be called, and its not the sort of thing I would imagine hadn’t already been discovered. If you do know of some prior art please drop me a line and let me know.
What I was looking for was a fractal curve that would
- Form a loop.
- Visit every square in a square grid.
I can’t actually remember what I wanted the curve for. I think it was for an optimization technique for a problem similar to the Traveling Salesman Problem. In any case, I did come up with one, which I’ve ended up calling the H-Fractal for reasons that should be obvious. In the diagrams below, ‘+’ marks the center of a square, while ‘-‘ and ‘|’ mark traversal paths into and out of squares:
- 2×2 grid
+-+ | | +-+
- 4×4 grid
+-+ +-+ | | | | + +-+ + | | + +-+ + | | | | +-+ +-+
- 8×8 grid
+-+-+-+ +-+-+-+ | | | | +-+ +-+ +-+ +-+ | | | | +-+ +-+ +-+ +-+ | | | | +-+-+ +-+ +-+-+ | | +-+-+ +-+ +-+-+ | | | | +-+ +-+ +-+ +-+ | | | | +-+ +-+ +-+ +-+ | | | | +-+-+-+ +-+-+-+
I haven’t worked out a good generating function or a formula to convert between (x,y) coordinates on the plane and position (t) along the curve, which is why it would be good if someone else invented this first, and did all the work already, so I don’t have to.