[OpenSCAD] Discuss manifoldness, co-incident faces edges etc

Doug Moen doug at moens.org
Thu Nov 14 13:22:06 EST 2019


If the libigl boolean operators are this good, why aren't we using them? There's no reference to libigl in the github issues or pull requests. In Feb 2018, on the forum, Marius said he had talked to the author, and: "I’ve been wanting to test that out, but haven’t managed to free up enough time to clean up our interfacing with CGAL to something that makes it clean to test out various libraries.. ".

To summarize things on my end, my goals in this thread are:
 * Support models containing polyhedra that touch at a vertex or an edge.
 * Support import of valid 3MF files (without getting a CGAL error).
 * Support export of valid 3MF files (with correct topology information included, unlike today)

My current suggestions are:
 * Change the PolySet structure to contain topology info.
 * Check imported meshes for bad topology[*] (not manifold, not correctly oriented, holes).
    If a problem is found, print a warning message and flag the mesh as non-manifold.
    Perform the same check on polyhedron() and polygon() output.
 * Use the libigl boolean operators, instead of CGAL.
 * Add a `repair_self_intersections()` module, based on libigl.

[*] Note, the "bad topology" check is relative to the topology information (vertex IDs), not the vertex coordinates. This distinction makes no difference for STL or polygon soup, but it does make a difference when importing file formats that support topology information, such as OBJ and 3MF. With the latter file formats, it is possible to encode two cubes touching on an edge as a 2-manifold shape.

These changes will improve OpenSCAD:
 * Far more forgiving of bad meshes on import.
 * Booleans are much faster. 7x faster on average, much bigger speedups are possible when you union a large number of complex shapes.
 * Far less likely to export a bad mesh.

Based on a test of 10,000 shapes from Thingiverse, only 18% of the meshes are damaged enough that the libigl booleans won't work. The number is close to 50% for CGAL and Carve.



More information about the Discuss mailing list