Hidden Wireframe Removal

I was disappointed that most computer graphics text books only discussed hidden wireframe removal for bitmap displays or optimized GPU algorithms, none of which were suitable for output the plotting devices or laser cutters. So I spent some time to rederive the logic of intersecting lines with triangles in space and hacked together hiddenwire.c to parse binary STL files and produce SVG outputs.

There are four levels of filtering that can be applied to the STL file - raw triangles, back-face culling to remove triangles that face away from the viewer, splitting line segments that are occluded by closer triangles (called "hidden line removal") and finally merging co-planar triangles to reduce the number of line segments that need to be drawn.

Source code is in github.com/osresearch/papercraft and is pretty messy. There are many improvements that could be made, both performance and correctness.

It works well with traditional plotters or polargraphs. I've been feeding STL files from thingiverse, like thing:3731, the Stanford Bunny, into the program at different levels of resolution.

For another approach, Paul Butler's penkit surface projection algorithm works well for certain surfaces that do not contain holes.

2017 Art Plotter STL

Last update: November 27, 2020