-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
render fails with polyhedron + cylinder union() #2398
Comments
The backtrace indicates a crash inside CGAL's union code (tested with CGAL 4.11):
|
@t-paul: do you see something wrong with this model? I am thinking that this rule may have been broken:
Specifically in each of the four corners, where the taller block has one triangle towards the vertical "corner edge", and the less tall block has one as well, but there is also a third triangle pointing inwards towards the model center. I'm not sure about this rule:
I have not (yet at least) understood the second part of that sentence. |
So anyway, I still do not understand the second rule:
So I simply ignored it. I then made a model where I followed this rule:
The logical consequence of this rule is that I have to "triangulate" everything manually for any model slightly more complex than a cube, far as I can tell. I did, and it works great. No more crashes, no more assertion failures either. I "triangulated" in a way that I suppose is logical to a human being, and that is simple to implement in code. That ended up increasing the amount of triangles by several magnitudes though. So both preview and render is really, really slow. It was also a hell of a lot of work. Using this method, about 10% of the work in using polyhedron() is defining points and shapes, an 90% is slicing things up into triangles where each side touch one other triangle. I also made another model using this home-made rule for polyhedron(): "For each line of each face you define, if there is a point along that line which is used in another face, make sure to include that point in the definition of the current face as well." It turns out that OpenSCAD is much better at turning faces into triangles than I am, as one can see after turning on "View --> Show Edges". Following the above rule worked exactly as well as doing everything manually, no assertions or failures either. It also previews and renders a lot faster than the manual method. Long story short, I think the wiki should probably state somewhere, for other newbies like me, the following rules: "1) For each edge of each face you define, if there is a point along that line which is used in another face, make sure to include that point in the definition of the current face as well. This ensures that OpenSCAD can properly turn the face into a triangle where each side touch exactly one other triangle.
Instead of the current rules that a) force a lot of manual work and b) is incomprehensible. Another idea would be to have OpenSCAD do the above automatically? In theory, it should be possible to take any faces that share a single point and check if any of their edges are exactly parallel. If so, and iff one of the edges is shorter than the other, automatically include the (previously non-shared) end point of the shorter edge in the face with the longer edge. If afterwards two faces have at least one point in common, check that they also have at least two points in common. If not, show a warning during preview (because CGAL will certainly throw an assertion during render). (After those two checks, turn faces into triangles as usual.) Not sure if it is realistic to implement, but if it was, it could potentially save a bunch of time for the next newbie... |
Thanks for being patient!
|
I think that just means faces that share a vertex should have the same winding order. I.e. all clockwise when viewed from the outside. |
Status as of 2024-03-24:
|
It seems that this code:
Crashes both OpenSCAD-Nightly and OpenSCAD with this error message:
When you click Render.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: