[OpenSCAD] F5 works, but F6 gives: ERROR: CGAL error in CGAL_Nef_polyhedron3():

Ronaldo Persiano rcmpersiano at gmail.com
Fri Jan 19 18:13:38 EST 2018


2018-01-19 3:52 GMT-02:00 Jordan Brown <openscad at jordan.maileater.net>:

> And a side comment that by a common-sense definition, a list of points
> that's not coplanar is not a polyhedron face.
>

​Most non-trivial sets of more than 3 points are not planar ​due to
floating point approximations. And some measure is necessary to cope with
the different number representations of OpenSCAD and CGAL. As far as I
know, OpenSCAD triangulates every polyhedron facet with more that 3
vertices precisely to avoid non-planarity issues. It can be argued that its
triangulation is not "optimal" in some sense but we cannot blame it for
doing this.

Polyhedron is a very flexible primitive. It is possible to define a
non-manifold and/or singular surfaces even with borders or multiple shells
with polyhedron. If degenerated faces are avoided, you can render it
nevertheless while no boolean operations is performed. That may be a hell
or a heaven depending on what you are doing or want to do.

What Uwe's workaround brought up is that the hull operator may "heal"
(most) defective polyhedron generating a valid solid with a manifold shell:
the convex hull of the polyhedron face vertices. That is nice, because
mathematically the hull operation does not require any structure linking
the points.

I don't think there is anything wrong with the current processing of
polyhedron. But...

Consider the following:

e = 5;

p = [ [0,0,   0],[10, 0,   0],[0,10,  0],[0,0,  10],
      [0,0,10+e],[10,10,10+e],[0,10,0+e],[10,0,0+e] ];

faces1 = [[0,1,2],
          [0,2,3],
          [0,3,1],
          [1,3,2]];

faces2 = [[4,6,5],
          [4,5,7],
          [4,7,6],
          [5,6,7]];

polyhedron(p, concat(faces1,faces2));


This polyhedron is really the union of a pair of tetrahedra provided that
the parameter e is positive. It can be boolean operated with another
primitive and renders fine. However, when I set the parameter e to 1e-6 and
union it with a cube, my 01.06 version running on Windows crashes. Worst
than that, setting e to 1e-5 I am able to render it unioned with a cube and
generate a STL file. Although the file is not defective (it represents
exactly the two tetrahedra with a small gap of about 1e-05) OpenSCAD
crashes when I try to import it.

Summarizing, my points are:
a) it is fine to define polyhedra that cannot be boolean operated because
they are not manifold;
b) it is fine that those polyhedra produce STL files that are not manifold
provided a warning is issued;
c) it is not fine that a STL file representing a manifold exported by
OpenSCAD cannot be imported by OpenSCAD.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20180119/2de0402e/attachment-0002.html>


More information about the Discuss mailing list