For some of my art projects I want to have lines drawn on a 3d surface. For drawing to the screen, it’s easy, as I have webgl. But for drawing to a plotter, I need to remove the hidden lines.

The idea is to have a *surface* made up of triangles. I need to sort these using painter’s algorithm and hope there are no glitches. I assume no overlapping cycles and no intersections.

All lines must be placed on that surface, and already broken down into segments for each triangle. This is a big limitation and means I’m not making a general purpose algorithm.

On a screen: for each triangle draw the lines for that triangle, then draw the triangle.

On a plotter: for each triangle, clip the lines then draw them, then add the triangle to the clip set.

I’m going to write a test program for the screen first.

- https://members.loria.fr/SLazard/ARC-Visi3D/Pant-project/files/Line_Segment_Triangle.html
^{[1]} - https://math.stackexchange.com/questions/2382016/determine-if-a-line-segment-passes-through-a-triangle
^{[2]} - https://stackoverflow.com/questions/50218139/fast-test-to-see-if-a-2d-line-segment-intersects-a-triangle-in-python
^{[3]} - https://dl.acm.org/doi/pdf/10.1145/361254.361264
^{[4]}- algorithm that works for joy plots