I had been experimenting with particle systems using a graphics API that made it easy to draw rotated images to the screen. If we constrain ourselves to particles that are 2x2 pixels and use only a single color, there are 15 distinct shapes that we might draw:
How small of a source texture can hold these 15 patterns? If memory serves, the solution came to me one morning just after I had woken up. After getting out of bed, I drew the following figure on the dining room whiteboard (a highly recommended dining room fixture):
By rotating 2x2 slices of this 6x2 image, we can derive the 15 patterns like so:
This is a case study in premature optimization, and I'm not even sure that it's faster than the naive solution. Still, it seemed a shame to develop the technique and never use it. The result is this animation.
Published 2020-04-06
Next: A UNIX command line utility for producing gibberish
Previous: A cartoon explanation of why web apps are more secure than desktop applications