Detailing

Logo

Adding complexity to polygons.

View the Project on GitHub MichaelMBradley/Detailing

17 May 2021

Arcs

by Michael Bradley

I began by fixing the bug in my traversal code from yesterday. When selecting a branch to traverse first, I assign a heading to each branch based on its real heading from the current position, and then sort by clockwise or counter-clockwise. Each heading is in radians, so I can simply sort the floats.

The difficulty comes from choosing a starting position. My code looks at the heading of it’s parent, and then modifies any values greater than (or less than, depending on direction) it by two pi, so that the order is preserved, but the start is offset.

Once I fixed the bugs there, I was able to produce the following.

A line travels around a circle packing of a shape.

From here, I tried to find a way to build a curve around the traversal.

The only attempt I was able to complete today relied on the fact that my trees were built from the Delaunay Triangulation of the circles, meaning that any two connected points in a tree had a third connected point forming a triangle, and I could use the circumcircle through these points as part of the curve.

The initial results weren’t ideal, as you can see below.

A connected series of trees forms a shape.

A connected series of trees form a shape over a circle packing.

While this is obviously not close to the final product this method may produce, its main shortcoming is evident. Because I traverse up and down each branch, every non-leaf node is visited twice, so that arcs on different points of the line meet at the same nodes. In the final version, the arcs will be smoothed so that this problem does not occur, but that is further down the line. For now, I will try another method based on connecting touching circles as some of that code will certainly be of use in other methods, and it’s final look is clearer in my mind.

Another problem I need to fix is the tree selection algorithm. I should consider:

This last point is important, as with more complexity it is easy not notice overlapping lines as trees are swapped between:

Significant vertical lines appear in between trees.

Tomorrow, I will also make a large effort to change the layout of my code to be in more files, as right now too many functions are crowded together, and it can be hard to find the one you are looking for (I’ll also redo some documentation).

tags: