discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

CGAL error in CGAL_Nef_polyhedron3(): CGAL ERROR: assertion violation!

M
Mekko
Sun, May 12, 2019 12:18 AM

I have reduced a problem to the following code:

points=[[-0.95, -0.95, 0.9525], [-0.95, 0, 0.05], [-0.95, 0.95, -0.8525],
[0, -0.95, 0.05], [0, 0, 0.05], [0, 0.95, 0.05], [0.95, -0.95, -0.8525],
[0.95, 0, 0.05], [0.95, 0.95, 0.9525], [-0.95, -0.95, 0.8525], [-0.95, 0,
-0.05], [-0.95, 0.95, -0.9525], [0, -0.95, -0.05], [0, 0, -0.05], [0, 0.95,
-0.05], [0.95, -0.95, -0.9525], [0.95, 0, -0.05], [0.95, 0.95, 0.8525]];

faces = [[0, 1, 4], [1, 2, 5], [3, 4, 7], [4, 5, 8], [0, 4, 3], [1, 5, 4],
[3, 7, 6], [4, 8, 7], [9, 13, 10], [10, 14, 11], [12, 16, 13], [13, 17, 14],
[9, 12, 13], [10, 13, 14], [12, 15, 16], [13, 16, 17], [0, 6, 9], [9, 6,
15], [6, 8, 15], [15, 8, 17], [0, 11, 2], [11, 0, 9], [8, 2, 11], [11, 17,
8]];

polyhedron(points, faces);

polyhedron(points, faces);

F5 is fine but F6 triggers an error message:
ERROR: CGAL error in CGAL_Nef_polyhedron3(): CGAL ERROR: assertion
violation! Expr: e->incident_sface() != SFace_const_handle() File:
/opt/mxe/usr/i686-w64-mingw32.static/include/CGAL/Nef_S2/SM_const_decorator.h
Line: 326

If I remove one of the polyhedron() calls, everything's fine. That's not a
usable fix, however, because I'm building a complex shape out of this
polyhedron and need to render it multiple times.

I looked at the .STL in MeshLab and couldn't find any problems (though I
don't know MeshLab very well) so I'm puzzled.

Can someone help me understand what I am doing wrong here? Thanks!

--
Sent from: http://forum.openscad.org/

I have reduced a problem to the following code: points=[[-0.95, -0.95, 0.9525], [-0.95, 0, 0.05], [-0.95, 0.95, -0.8525], [0, -0.95, 0.05], [0, 0, 0.05], [0, 0.95, 0.05], [0.95, -0.95, -0.8525], [0.95, 0, 0.05], [0.95, 0.95, 0.9525], [-0.95, -0.95, 0.8525], [-0.95, 0, -0.05], [-0.95, 0.95, -0.9525], [0, -0.95, -0.05], [0, 0, -0.05], [0, 0.95, -0.05], [0.95, -0.95, -0.9525], [0.95, 0, -0.05], [0.95, 0.95, 0.8525]]; faces = [[0, 1, 4], [1, 2, 5], [3, 4, 7], [4, 5, 8], [0, 4, 3], [1, 5, 4], [3, 7, 6], [4, 8, 7], [9, 13, 10], [10, 14, 11], [12, 16, 13], [13, 17, 14], [9, 12, 13], [10, 13, 14], [12, 15, 16], [13, 16, 17], [0, 6, 9], [9, 6, 15], [6, 8, 15], [15, 8, 17], [0, 11, 2], [11, 0, 9], [8, 2, 11], [11, 17, 8]]; polyhedron(points, faces); polyhedron(points, faces); F5 is fine but F6 triggers an error message: ERROR: CGAL error in CGAL_Nef_polyhedron3(): CGAL ERROR: assertion violation! Expr: e->incident_sface() != SFace_const_handle() File: /opt/mxe/usr/i686-w64-mingw32.static/include/CGAL/Nef_S2/SM_const_decorator.h Line: 326 If I remove one of the polyhedron() calls, everything's fine. That's not a usable fix, however, because I'm building a complex shape out of this polyhedron and need to render it multiple times. I looked at the .STL in MeshLab and couldn't find any problems (though I don't know MeshLab very well) so I'm puzzled. Can someone help me understand what I am doing wrong here? Thanks! -- Sent from: http://forum.openscad.org/
A
adrianv
Sun, May 12, 2019 12:47 AM

Are you actually running polyhedron twice?  If so, why?  I am only able to
get that error when I include the doubled call to polyhedron.  I'm not sure
why that should be an error, but I never saw it with just one call.

--
Sent from: http://forum.openscad.org/

Are you actually running polyhedron twice? If so, why? I am only able to get that error when I include the doubled call to polyhedron. I'm not sure why that should be an error, but I never saw it with just one call. -- Sent from: http://forum.openscad.org/
A
adrianv
Sun, May 12, 2019 1:02 AM

Ok, so I looked at your example and didn't read your text very closely:  I
thought it was weird that you were creating two copies of the same shape on
top of each other, but I realized upon further testing that it doesn't
matter where the two copies of the polyhedron are.  I checked the face
orientation and it appears to be correct (clockwise).

Have you tried removing sections of the polyhedron?

--
Sent from: http://forum.openscad.org/

Ok, so I looked at your example and didn't read your text very closely: I thought it was weird that you were creating two copies of the same shape on top of each other, but I realized upon further testing that it doesn't matter where the two copies of the polyhedron are. I checked the face orientation and it appears to be correct (clockwise). Have you tried removing sections of the polyhedron? -- Sent from: http://forum.openscad.org/
M
Mekko
Sun, May 12, 2019 1:23 AM

Actually, I just figured out what the problem was and I'm embarrassed to say
it's a mistake I've made before - sorry to waste time and space on this
forum!

(The error was that the polyhedron has some edge faces that need to include
all the vertices of triangles that the edge facese line up against.)

--
Sent from: http://forum.openscad.org/

Actually, I just figured out what the problem was and I'm embarrassed to say it's a mistake I've made before - sorry to waste time and space on this forum! (The error was that the polyhedron has some edge faces that need to include *all* the vertices of triangles that the edge facese line up against.) -- Sent from: http://forum.openscad.org/