# Rainbow Disks

Square made these super cool shirts for Pride 2015 that filled in the negative space around the Square logo with rainbow bands of circles. This project is one way to automate that process.

## Problem Definition

This isn't really the sphere packing problem in the pure, mathematical sense. The actual sphere packing problem aims to find an optimal solution, filling a region with the greatest number of spheres of some size possible. Instead, we only want to make a patch of circles that is relatively dense in the middle and decreases in density as you approach the edge, while avoiding the areas blocked by an image (which we represent with a 2d numpy array).

## Solution

For "packing" the circles, we'll use the "growing circles" method described here. Basically, we create circles that grow until they cannot grow any more, iteratively adding tiny circles to the canvas:

block_mask := input image mapped to a 2d boolean matrix
circles := ∅
while |circles| < N
For each pair of circles i, j in circles
If i collides with j, mark i and j as dead
If newc is dead, remove it from circles
For each circle c in circles
continue
If growing by const x does not touch block_mask