Z-clipping demo in 1998
Once I had my first 3D engine written in turbo pascal back in the 90s I wanted to do something a bit more original. So I plowed through the Computer Graphics book recommended by Prof. Arickx during my student years.
Then I created this effect. It does real time z-clipping on any 3D object and it runs smoothly on a pentium 133mhz .I chose a doughnut as example because a torus is just a cool object and made a reference to the Simpsons which was popular at the time. The engine could actually slice any 3d object in the same way. That machine was 8-10 times slower than what a raspberry pi 2 has to offer today. Have you ever sliced an stl file on a raspberry pi? Yeah : it can take literally minutes.
The majority of what slic3r, Cura or other slicers do is slice an stl file (being a large file where the object is represented by triangles) containing the object along the z-ax and then proceeds with an infill for each layer (honeycomb, raster or etc). Imagine the same optimizations done for a stl to gcode slicer. You'd literally do 25 layers per second. So for instance an object of 10cm high sliced at 0.25 layers would take you (400/25 == 16) roughly 16 seconds to slice, on a pentium at 133Mhz. So divide by roughly 8 for a raspberry pi 2 running at 1.2Mhz and you'd get 2 seconds to slice it + 1 or 2 seconds to infill each layer as well. And yes this demo is actually also doing infill as well. Because I only draw pixels, no OpenGL is used here, just plain putpixel to coordinate x,y. Basically the code running in the demo also has to infill all the remaining triangles after a slice too ;).
It doesn't really matter much anymore. Nowadays laptops and desktop pc's are so fast now that you can slice your stl files 'fast enough'. But it does show there is a huge leap of improvements that could be done performance wise by fine tuning the algorithm as was done here.
You can still watch the effect using this dosbox project made ready for macOS. Just download this DOSBOX demos zipfile , unpack, run dosbox and then type zclippin + enter.