Cool-or Particles

I wrote a code in Mathematica some years ago for creating pictures based on circles. I totally forgot about it until few days ago while working in Poison-Disk grids and finding this. I couldn't find the original code so i just wrote it again! (For some JC code with D3 check here!) The idea is as follows:

  1. I plan a particular geometry for which story I want to tell. For instance, I want to represent the Transit of Mercury. I just need then the Sun, Mercury and a bounding box. Easy, both bodies are just disks and the bounding box is a rectangle.
  2. I randomly generate disks inside the boundaries of the box. The radius of the disk is a random value between a predefined minimum and a maximum radius. However, I don't want it to overlap with other disks, so I take care that the center of the new disk does not fall inside a previous one. If this happens, I just discard that position and look for a new one. If the position is ok, the radius of the disk is as maximum that one that avoids to touch any neighboring disk or border. For instance, I define the boundary of the Sun's disk so it can become apparent at the end of the process.
  3. I assign a random color but following some predefined patterns. I can define a rule for the colors depending on position and add some fluctuations. For the Sun is clear: inside the Sun, disks are something between red and yellow; outside the Sun, disks go from red to blue to mimic the corona. Eventually, a disk can be light blue to represent background stars.

Voilá:

bolas1.jpg

I can play with the bounding box, or even with the size of Mercury to represent an eclipse with the Moon instead.

Cool animations can be done with this material!

With some post-production it can look as a photo of a real paint! Other shapes can be explored as well, the only limitation is imagination!

Why not Saturn?

 

Yeah, anything's possible! Check for the basic javascript version (sorry for the style, it's literally my first JS ever).