# teaching machines

## Flatcaps in Libigl

Madeup’s dowel solidifier has one job: thicken a sequence of line segments into a solid. But what if the sequence isn’t a polyline, but rather a branching structure like a tree or a fork? One could model each branch as a separate dowel and hope that nobody looks too closely at the joints, but that’s not really a solution. Good news, though! I may have found a better one.

To subtract and join meshes, Madeup depends on libigl. A few months ago, Alec Jacobson announced that his team had added wire mesh generation to libigl. I used this feature to add a new solidifier to Madeup for branching structures. I named it network.

Even on the first run, it was quite obvious that my use case was a bit different than the libigl team’s. Normal people generate wire meshes for closed surfaces, in which each vertex is incident on at least a few faces. Here I was with a network of line segments, with a lot of dangling terminal vertices. The result wouldn’t make it through airport security:

I wanted the caps to be flat, so I asked the libigl folks how much work that might be. They actually responded and were reasonable human beings, so I dove into the source and figured out how to suppress the pointiness for terminal vertices. I like this much better:

They even approved my pull request. But really, it was a push request.