-
-
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
Review and possibly clean up triangulation code #414
Comments
Hi, I second this issue! :) Current triangulation method (displayed on the left) often makes degenerate triangles... And I think the method itself is rather strange, yeah. Does it have some well-known name? Does it have any advantages over the second method? And do you have some work-in-progress patch for this issue somewhere? Maybe I can test it? |
there is a very small patch (2 lines?) you can make to src/CGAL_Nef3_workaround.h that will use a Constrained Delaunay Triangulation on STL output. someone (I forget their name, sorry.. its in the issues or mailing list archive somewhere) has tested it quite a bit but it hasn't made it to any branch that i can remember. |
Thanks, I assume you were talking about http://rocklinux.net/pipermail/openscad/2010-August/000572.html ? (btw, did someone answer that man ? I don't see any replies there... :))) Now it's possible to do that without patching CGAL, see commit vitalif/openscad@f1cf6cb What I want to ask is - does current triangulation method offer any advantages over Delaunay? If not - maybe just replace it totally? |
2010, i did not know about that discussion! ... there was a discussion last year in 2013 that is basically the same. . . . the introduction of the 'workaround' code is what allows this to exist without having to patch CGAL.. as you have shown!! the current method of triangulation is whatever CGAL uses internally, i'm not sure of the name or if it's even documented. i assume its some kind of ear-clipping which, in theory, would be faster than Delaunay Triangulation because there is no 'refinement' step. (for readers who may not know, Ear Clipping triangulation of a polygon is really simple, as most algorithms go, you can google around and find some pseudo code that is only a few lines). the disadvantage of switching is that we dont know if the CGAL delaunay is as stable as we would like, or if the slowdown is an issue. someone did a lot of testing and it seemed to be OK,.. (of course i cant find the link right now... i know someone did try the examples and they seemed to work) maybe Marius would agree to enable this as the default triangulation in the 'unstable' branch. (I would like for us to at least try it...) |
:-) ok, please test it. I've already built some models with it, it seems to work good, and I didn't notice any slowdown. |
Hi again, did you try it? |
not yet. how does it do on ctest -C All (doc/testing.txt) ? |
I've just ran the tests... The following tests FAILED: |
Oh, sorry. They fail anyway with the version I've tested, even without the delaunay patch :). So it doesn't affect the test output... |
The issue tests are supposed to fail as they're related to open issues. |
ok, very good! :) |
I'll take a look at it soon |
I tried one of the patches to enable delaunay triangulation. It did produce nicer meshes but I still got quite a number of zero and intersecting faces flagged in the blender toolbox when exporting to STL. I did not collect performance data about that, but it seemed to have not much impact with the mildly complicated models I tried. |
And on which models did you test it? You say you've got some bad faces - so are they complex? |
Not sure, that was quite some time ago. I do think we should try out the delaunay triangulation, I just wanted to point out that we might still need some kind of mesh cleaning or STL export improvements as delaunay probably will not solve all the issues. |
Does anyone have good examples to test with? The design causing the triangulation in the initial screenshot would also be nice to have. |
I've put the patch in a separate branch for now: https://github.com/openscad/openscad/tree/issue414 |
Does it enable delaunay for both STL and OFF export? |
I just applied the patch I found. We should probably refactor this a bit. Good triangulations might be needed in other places where we convert from Nef polyhedrons to something else. |
I just realized that we have some other code lying around which should be looked at: |
also, to be able to test this properly, we should probably start looking at export testing (#622). |
Not sure if it is the same one but the smallgearmod_fixed_1.stl at Greg's Wade extruder for Prusa i3 look like it. |
Good new & bad news. Traced it back. But exported STL (with 2014.03) does not have the odd facets on the base. I'm presuming 'fixed' may have caused it??? Herringbone design Wades_Gears_helix.scad from Wade goes Fishing Needs parametric_involute_gear_v5.0.scad from Parametric Involute Bevel and Spur Gears Generates a few |
Model with odd facets seems to have come from Greg's Wade reloaded - Guidler, Tilt Screws, Fishbone Gears In the comments "Hi, actually I only modified the STLs from Stoffel15's Extruder" (which is the Wade goes fishing above). Then in relation to the gears, "Not a real source file as you would expect, I just hacked Stoffel15's STL files via import(); in OpenSCAD". And "I modified the STLs via STL-import with OpenSCAD for better fit of the nut slot etc". I couldn't see any scad code for that. So I suggest the 'fixed' may have done it. |
@MichaelAtOz Thanks for hunting! I've tried to ping the original poster about this. |
This need a bit more work. Triangulated geometry is being calculated in 4 different places:
I'll look into if we can collect some of these into more well-defined utilities. |
I think I might be able to provide some more detail on that list and add one.
(updated to be more accurate in a few places, clarify Clipper, link to Oskar's patch/bug report) note for future self. the Boost library has a very new Voroni tessellation diagram generator that uses Integer arithmetic. It is apparently, according to the authors, quite fast. The reader may be aware that Voroni tessellation is the 'dual' of the Delaunay triangulation. In other words, it is not 'rocket science' to convert a Voroni Tessellation to a Delaunay Triangulation. |
This issue is about reviewing and possibly cleaning up the different pieces of triangulation code we use in various places. Things are much cleaner now than when this was first raised, but a review is still needed, plus sync this with #793
Old text:
there should be different suface triangulation algorithms available when outputting STL.
per here:
http://forums.reprap.org/read.php?1,127368,164896#msg-164896
related to issue #337
(the code for 337 will directly make this much easier to accomplish)
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: