Convex Hull + STL Export

Big breakthrough today on the way toward realizing the UCube. I finally got code working in Processing that takes an arbitrary number of 3d coordinates (in x,y,z format), finds the convex hull, and is able to export a file of the shape that can be read accurately by 3d printers.

First, what a relief. I had been working on getting a convex hull working for a few weeks now. Second, I’m standing on the shoulders of giants, as always. The code below makes use of two libraries: the quickhull3d package by John Lloyd, which I turned into a processing library, and the awesome unlekker library from Marius Watz, which allows the nice export to .stl capabilities.

Here’s the Processing version of the quickhull3d library I used/adapted. Just unpack it and drop it in your Processing->libraries folder. quickhull3d

The example below just takes a bunch of random points and displays something like this:

You could, of course, populate the array with the coordinates you wanted.