2 ms·
I implemented drawing of polygons orthographically quite some time ago. The output was for PDF, so I couldn't raster + zbuffer. Instead I drew all polygons back
by joakleaf 10y ago
I implemented drawing of polygons orthographically quite some time ago. The output was for PDF, so I couldn't raster + zbuffer. Instead I drew all polygons back to front.
I ended up creating a BSP tree (1) for the polygons and drawing them in order according to the tree.
The problem in general with sorted back to front drawing is exactly the "Conundrum" example. However, a BSP tree will take of that, and divide at least one of the cubes in that example.
It may feel like overkill, but I would probably have done something similar in this case. Implementing BSP trees for cubes is very simple, because all planes are xy, xz, or yz.
[1] https://en.wikipedia.org/wiki/Binary_space_partitioning https://en.wikipedia.org/wiki/Binary_space_partitioning