# Wolfram Function Repository

Instant-use add-on functions for the Wolfram Language

Function Repository Resource:

Generate circle packings covering a picture

Contributed by:
Christophe Favergeon

ResourceFunction["DigitalCirclism"][ compute a circle covering of an |

ResourceFunction["DigitalCirclism"] can use the following options:

"TimeConstraint" | 180 | the maximum number of seconds allowed for the computation |

"Pad" | 0.0 | the padding between the circles |

"DrawingFunction" | Automatic | how to draw and style the circles |

"CompositionFunction" | Automatic | how to compose the image and the circles |

"RawResult" | False | whether to return an image or the list of circles |

"Radii" | {50,20,10,5,3,2} | the list of radii used to shrink the radii of the covering |

If the maximum number of seconds have been reached, a result will be returned but it may not contain all the circles.

The "DrawingFunction" option accepts a function of the form *drawfun*[*image*,*centers*,*radii*].

The "CompositionFunction" option accepts a function of the form *compfun*[*image, graphics*] where *graphics* contains the circle covering.

When "RawResult" is True, the function returns a pair of lists: list of centers and list of radii.

The option "Radii" is used to filter the circles from the picture. The algorithm will try to place the biggest circles first. When a circle cannot be placed because it overlaps with other circles, then it will be reduced to the next radius found in the "Radii" list. In practice, you won't often see a big difference in the resulting image if you change this list.

The "Radii" list should be ordered in decreasing order with the smallest radius last.

Generate a circle covering for a sample image:

In[1]:= |

Out[1]= |

We can replace the disks by regular polygons or any other shapes we’d like to use. The opacity can be changed. A "DrawingFunction" option is provided for that purpose:

In[2]:= |

Out[2]= |

The circle covering and the image can be composed in different ways. A "CompositionFunction" is provided for that purpose:

In[3]:= |

Out[3]= |

Retrieve an image:

In[4]:= |

Out[4]= |

Compute the digital circlism directly:

In[5]:= |

Out[5]= |

Show the circles omitting the largest three:

In[6]:= |

Out[6]= |

- arihant-001 GitHub–Circlism
- Generating visually pleasing circle packs–Mathematica Stack Exchange
- "Digital Circlism: arrangement of circles over an image"–Wolfram Community
- Digital Circlism as Algorithmic Art–Partha Bhowmick

- 1.0.0 – 04 February 2021

This work is licensed under a Creative Commons Attribution 4.0 International License