http://www.anthonymattox.com/cell-cluster-circles
Mattox's design is characterized by its apparently random distribution of small circles within the boundary of a much larger circle. The closer a circle is to the center of the design, the less its saturation, although all circles seem to be the same hue, and the most visually interesting thing about the design (at least in my in opinion) is that none of the circles overlap.
-APPROACH-
I approached this problem by first listing the various specifications that define the design and assigning an order of importance. The list looked something very similar to this:
1. Random Circles within a circular boundary
2. No circles overlap
3. Circles appear to completely fill the space with almost no white space
4. Circles lose saturation as they appear closer to the center
I decided to treat circles as objects and created the myCircle class. A myCircle is declared with an x,y coordinate position and a radius. The circle can be drawn by calling its myCircle.draw() function. A myCircle object has two methods for checking boundaries: isWithin(myCircle c) and touches(myCircle c). These functions return boolean values and make specifications 1 and 2 above very quick and easy to calculate.
The program initializes by creating a large myCircle right in the center of the window. Everytime a new circle is created, it calls the isWithin(myCircle c) method to make sure it is inside this circle. It then begins checking every previously added circle within the larger circle.
Any circle added to the design is stored in a Java LinkedList. I chose a LinkedList over an array because the nature of the program makes it difficult to predict the exact number of circles that can be added, and I didn't want to have to go around redefining my array everytime a new circle was added.
Once I got my program to add random circles within the large boundary circle, I decided to make sure the program was packing in as many as possible. Up until this point, I had been using a for loop to create the random circles with an arbitrarily smallish number (about 500 or 1000). To fill in the large amount of white space those smaller numbers made, I increased the size of the for loop dramatically (about 10,000 or so). I found that this would make the program hang up almost indefinitely since the way it works, the counter only increases if a circle actually passes its test to get in (in other words, 1000 iterations means 1000 circles are added to the list, not just 1000 circles are attempted to be added). To solve this, I created another counter that would count how many attempted circles it takes before a passing circle is created. If this number exceeds a certain amount, the loop breaks. This number (nMax in the code) is currently set to 100,000. With the number of loop iterations at 15,000, the program usually returns a cell cluster of around 6,000 circles (give or take 1,000) and takes roughly 5 minutes to compute (estimated, I haven't actually timed it). I also found that restricting the size of each circle helped.
Now that the program can draw a full, tight cluster of circles, it's time to tackle coloring. I started out with my own, easy version. I added R, G, and B integer values to the myCircle class and made it so that every time a circle is made, it assigns a random integer value to these variables. This made each circle come out with a very colorful, rainbow circle. Very neat, but not what I was aiming for. Since the Cell Cluster Circle by Anthony Mattox had circles of the same hue with decreasing saturation, I made some global R, G ,and B values. Then, in the draw() method, I created a gradient value by dividing the distance between the center of each individual circle and the center of the large boundary circle from the radius of the boundary circle. I then multiplied this value to each of the R, G, B values and created a gradient effect very similar to the one seen in Anthony Mattox's design. Anytime I wanted a different color, I had to change the R, G, B values manually, but the results were fairly close.
-RESULTS-
Here, finally, are some of my results.


