From Trammell Hudson's Projects
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/osresearch/papercraft and is pretty messy. There are many improvements that could be made, both performance and correctness.
For another approach, Paul Butler's penkit surface projection algorithm works well for certain surfaces that do not contain holes.