Detailing

Logo

Adding complexity to polygons.

View the Project on GitHub MichaelMBradley/Detailing

5 May 2021

Graphing

by Michael Bradley

Now that I had some basic circle creation working (circle packing is a bit loose of a term for what I’ve actually implemented), I could start creating a graph.

A series of circles cover the edges of a polygon, with lines connecting the circles touching each other.

However, I decided to slightly change my approach to generating circles. Before, I simply randomly packed a square around the polygon and then deleted any that were too far away from an edge. Now, I changed my strategy to not only reject a potential new circle when it was occluding a previous circle, but also when it was too far away from the existing lines. I also significantly increased the number of consecutive failed attempts at placing a circle required to stop generation, resulting in an overall denser packing.

A series of edge packings, with the circles connected by a graph.

It still generated packings relatively quickly, although there is much room for improvement. I found writing out a series of points to describe the edges of new shapes tedious, so I quickly threw together a program to let me draw them.

An irregular polygon is drawn.

I then made some constants variable based on the size of the inputted shape, although these variables will still need tweaking as I believe that I am now generating too many circles. I also needed to spend time to fix a bug that incorrectly counted the number of connected graphs present, but that was quickly remedied with a new strategy of sets and recursion.

A series of circles cover the edges of a polygon, with lines connecting the circles touching each other.

In the coming days, I’ll need to find a way to turn these circles back into a line. I have a vague strategy about following the perimeter of the polygon on whatever part of a circle is nearest to the initial edge, but it will need to be fleshed out.

tags: