-
Notifications
You must be signed in to change notification settings - Fork 141
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
V5 — fully robust, no transpilation, native ESM #68
Conversation
On principle I agree that we still too often have these precision issues, in particular in generative art code where points will often be aligned (vs "actual" data where Delaunator never fails). So I'm all for the extra cost if it can solve these. I wanted to build d3-delaunay with this branch, however I am so bad with javascript plumbing, and failed. |
I was wondering how much the robust check would affect performance. I ran the v4, 1,000,000 points, 4 runs
v5, 1,000,000 points, 4 runs
I'm surprisingly bad at benchmarking though so I wouldn't be surprised if I did something wrong. |
@Fil didn't expect any problems with integrating this into d3-delaunay, can look at it next week. Of if you have any more details, I'd be happy to help. @redblobgames that looks similar to what I've been getting and I think the results are pretty reasonable, even good considering the change. |
Nah no real problem, it's just that I don't know how to do it. What I tried
was to replace the delaunator folder in npm_modules! probably not the right
method :-)
|
@Fil you can just do |
Thanks! With this it builds*, but alas it doesn't seem to solve this half-baked experiment * build with
|
@Fil great test case! At least the Delaunay triangulation on it visually looks correct, so there might be an issue hidden in the Voronoi code. Although Delaunay might be broken in a non-visual way (bad connectivity) — will check this one next week. |
Yes, this will need adjustments — in short:
|
@Fil just to make sure, I added a sample test case from your notebook to the test suite and it passes robustness tests (triangulation is valid, with no broken halfedges etc.), so the issue must be on the |
Sorry for the delay. (And thank you for the "adjustments" in tests!). I can now confirm that the issue lies with d3-delaunay, in the special case it does for circumcenters of degenerate triangles in https://github.com/d3/d3-delaunay/blob/master/src/voronoi.js#L43 I can fix it for this example, but then it breaks a few other tests which are themselves a bit dubious. More later, but please don't hesitate to merge this. |
This is great! |
"type": "module"
and native ESM, requiring Node v12+.robust-predicates
to solve Triangulation is not robust (fails for certain floating point input) #61, add more robustness test cases.buble
transpilation and drop firsthand support for IE11.The
robust-predicates
change makes the bundle ~32% bigger — from 2286 to 3029 bytes minified/gzipped. Previously I thought I should expose a separate "robust" bundle in addition to the smaller one, but now it seems that at a scale of few kilobytes, it's not worth the added complexity and the increase isn't a big deal.Adding robust
incircle
would increase it more significantly (to 5322 bytes), but it doesn't seem necessary since this check only affects which triangles flip, and doesn't affect the integrity of the triangulation unlikeorient2d
.@mbostock @Fil what do you think?