[OpenSCAD] Discuss manifoldness, co-incident faces edges etc
doug at moens.org
Wed Nov 13 18:16:18 EST 2019
On Wed, Nov 13, 2019, at 8:05 PM, nop head wrote:
> There is no guesswork needed to read an STL if the geometry it contains is manifold.
Not true. STL is ambiguous even if it is 2-manifold, because it can still contain self-intersections. Self intersecting STLs are interpreted differently by different slicers. You mentioned this yourself in a previous message:
> I was given an STL file and just sliced for my machine and filament and started printing. I thought the design was very weak but I had printed dozens before I realised it contained self intersections and when sliced with a different sliced it made a totally different object.
Just to be clear, the 2-manifold property doesn't say anything about whether a mesh is self intersecting or not.
OpenSCAD can export self-intersecting STL just by intersecting some shapes that are themselves free of defects. And you don't get a warning when this happens. Nobody seems to know how to fix this. So STL files exported by OpenSCAD may be ambiguous.
3MF does not suffer from the same problem. 3MF meshes are required to be 2-manifold (the 2-manifold property applies to vertex IDs, not vertex values, as I explained earlier). However, 3MF meshes are allowed to have self-intersections, because lots of different mesh generation programs (not just OpenSCAD) produce self-intersecting meshes, and nobody knows how to fix this. 3MF works around this problem by mandating a specific algorithm that slicers must follow to interpret self-intersecting meshes. As a result, 3MF meshes are portable: they are guaranteed by the standard to print the same way on all slicers.
There's more. OpenSCAD polygon-soup meshes can change from being manifold (in the CGAL data structure) to non-manifold during STL export, due to the conversion of exact rational numbers in the CGAL data to approximate floating point in the STL output. Two vertices that are distinct in the CGAL data can become equal in the STL output, and that's enough to make the mesh non-manifold. And we don't know how to fix this.
This problem is fixable for 3MF export. All we need to do is preserve the "topology information" (the vertex table) when we convert CGAL data to 3MF data. The 2-manifold property that is defined on vertex IDs in the vertex table is not affected by conversion of exact rationals to floating point. What can happen is that two vertexes with distinct IDs and distinct coordinates can become modified by conversion to floating point, so that the coordinates are the same. But the vertex IDs are still distinct. And this situation is permitted by the 3MF standard, so the mesh remains valid.
In conclusion, STL export is inherently broken and cannot be fixed. However, 3MF export can be made to work correctly, if we modify OpenSCAD to preserve and maintain 3MF topology information.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Discuss