Friday, May 8

Week 7: How to Make a Polygon!

I'm elated. I just typed about one hundred lines of code, describing a fairly complicated algorithm I created on the fly, sure that it would fail horribly, and it worked. The first time. Practice makes perfect after all.

That algorithm took the lines created from the intersection of the STL 3D mesh and some plane, removed duplicates, then joined them together into polygons. Each line endpoint was joined to its nearest neighbor within a specified tolerance (for more robust results than other algorithms), and the end result was a set of disjoint polygons. Voila!

Filled polygons and a black canvas in the back.
That concludes the hard part of this program. All that's left to do is display images on a projector, interspersed with sending serial commands to the 3D printer itself. In fact, notice the black background: that's a full screen window ready to display those images. The year's coming to a close, and so is this program.