Renders fine but fails validity check

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Renders fine but fails validity check

Mekko
I'm screwing up something basic with polyhedron() and need some help. My
shape previews (F5) and renders (F6) fine but if I check validity, it fails
and OpenSCAD says:

ERROR: CGAL error in CGAL_Nef_polyhedron3(): CGAL ERROR: assertion
violation! Expr: e->incident_sface() != SFace_const_handle() File:
/data/OpenSCAD/libraries-mingw32-master/mxe/usr/i686-w64-mingw32.static/include/CGAL/Nef_S2/SM_const_decorator.h
Line: 326

I thought maybe I was screwing up the winding order but F12 doesn't show any
problems. (By the way, I looked at the online documentation and I think I
found an error in the example:
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/FAQ#Why_is_my_model_showing_up_with_F5_but_not_F6.3F

The picture of the pyramid with the purple face is confusing because for the
points and faces given in the example, the purple face is the rear face, not
the front one.)

Anyhow, back to my problem. Here are the points and faces:

cube_s = 20;

piece_pts = [
    [0, 0, 0],
    [cube_s, 0, 0],
    [0, cube_s, 0],
    [cube_s, cube_s, 0],
    [cube_s*2, cube_s, 0],
    [cube_s, cube_s*2, 0],
    [cube_s*2, cube_s*2, 0],
   
    [0, 0, cube_s],
    [cube_s, 0, cube_s],
    [0, cube_s, cube_s],
    [cube_s*2, cube_s, cube_s],
    [cube_s, cube_s*2, cube_s],
    [cube_s*2, cube_s*2, cube_s],
   
    [cube_s*(3/2), cube_s, cube_s*(1/2)],
    [cube_s*(1/2), cube_s, cube_s*(1/2)]
];

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

This works (i.e., it renders)

polyhedron(piece_pts, piece_faces);

but it triggers the error message I mentioned above. And if I try to render
two copies of the piece, it won't render at all (and gives the error
message). Here's what I mean by rendering two copies:

polyhedron(piece_pts, piece_faces);
translate([60, 0, 0]) polyhedron(piece_pts, piece_faces);

What am I doing wrong and how can I diagnose a problem like this in the
future (other than posting on this forum!)

Thanks!








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

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Renders fine but fails validity check

NateTG
Can you try:

piece_faces = [
    [0, 7, 8, 1],
    [7, 0, 2, 9],
    [0, 1, 3, 2],
    [10, 12, 6, 4],
    [12, 11, 5, 6],
    [3, 4, 6, 5],
   
    [7, 9, 8],
    [8, 3, 1],
    [9, 2, 3, 14],  //was [9, 2, 3]
   
    [3, 13, 10, 4],  // was [3,10, 4]
    [11, 12, 10],
    [5, 11, 3],
   
    [8, 11, 13],
    [11, 10, 13],
    [8, 13, 3],
   
    [14, 3, 11],
    [8, 14, 11],
    [8, 9, 14]
];

instead of what you have?

If that fixes the problem it was caused by having the edges of two different
triangles meet up with the edge of one.  That can cause problems if software
assumes that triangles line up edge to edge.



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

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Renders fine but fails validity check

Mekko
NateTG,

Yep, that did it. Thank you!

I didn't know that I needed to specify a face with *all* its points even if
some were co-linear.





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

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org