openscad/openscad — pull request #213 by donbright (2012-10-28 19:51:23+00:00)
Title: Issue202svg

This is to fix issue #202 , the projection crash, including the minimal example given by marius and the example002 example. Existing tests pass 100%.

As discussed, the code first tries to intersect the Nef3 poly with the xy_plane, and if this fails, it falls back to intersection with a large flat box.

The big-box code has been modified from the old version, to use CGAL-only construction instead of Polysets. It also uses z=-eps and z=eps because when z=0, CGAL's interesction bugs manifest.

A large amount of debugging was required to get this working. This debugging infrastructure has been included, specifically dump() code for Nef3 and Nef2 polyhedra to SVG format, which allows for textual inspection as well as graphical inspection of the data structures. (it is not yet suitable for user-generated SVG export). There is an extremely simple logging class added as well, in anticipation of boost.log being used some day.

If desired, I can remove the SVG + logging code if desired and resubmit this patch with only the Projection fix. But as I anticipate the usefulness of the debugging code for future bug fixing, i wanted to try to include it here.