-
Notifications
You must be signed in to change notification settings - Fork 949
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
"Unable to complete output ring" error using @turf/difference #2409
Comments
Found this issue mfogel/polygon-clipping#142 Have they abandoned polygon-clipping? Any chance of turf using polyclip-ts instead? |
Thanks for raising this. I'd need to spin this up on Codesandbox to properly verify but this sounds like a bug. I am not familiar with polyclip-ts but if it is handling a case that polygon-clipping is not perhaps you could raise a bug with the |
@JamesLMilner I looked at this a little closer and you'll see polyclip-ts does suggest to have addressed a variety of existing bugs in polygon-clipping - luizbarboza/polyclip-ts#1. It's more than just a simple TS migration. I didn't find breadcrumbs to suggest what was done to address these issues, it's all lumped into one big migration commit (luizbarboza/polyclip-ts@141a6a1), but I did see use of Difference in performance vs. polygon-clipping, and a sense of whether polyclip-ts will be actively maintained is unclear. @SbanksX perhaps you can share a little bit more and any performance differences? Thank you for the work you did on it. |
@twelch I haven't done benchmark tests, but probably my version is relatively slower than the original. I used the bignumber.js library to get more precision and work around floating-point arithmetic errors, which can reduce performance. Also I changed the splay tree library that was being used by splaytree-ts, as the previous one was causing known errors. Possibly there are optimizations that can be done, an example would be the use of priority queue instead of splay trees for some occasions, as already pointed out in the paper of the algorithm. There are also additional operations that were necessary when dealing with floating-point arithmetic, but which may not be useful now, and may even be removed, which could compensate for some of the performance losses. There is also this optimization to be done. There is a trade-off when using this version, so I recommend knowing what your intentions are and what you want to achieve before you go for it. It is also possible to solve several problems of the original library without making big changes, just using better logic to deal with floating-points (see The Floating-Point Guide). Before I decided on another approach that didn't involve floating-point, I had made some modifications to the original library and ended up solving several, but not all, problems that had already been pointed out, without breaking any of the tests that already existed in the library. |
I'm not sure what to make the conversation around performance here. Only one library, I would suggest this: go ahead and switch to In terms of maintenance, I don't see why |
@markstos I think your suggestions are well founded and what I think as well. What we're short on here is maintainers with time to contribute. Any help is welcome. Opening a PR that makes the initial switch, passes all existing tests, and shares a couple of performance numbers for non-trivial examples would be super appreciated and likely pick up contributor interest to help get it over the line (potentially adding tests for the 20 tickets it may resolve). |
@twelch I took a swing at contributing such a PR, but ran into an issue with |
Also running into similar issues with intersect of newest turf version. I would appreciate a switch to polyclip-ts, as mentioned here and in other issues / PRs, if it really helps. It seems to solve quite some issues. |
Using turf 6.5.0 I get an odd error in a very specific case and I cannot understand why.
Providing a minimal test case to illustrate the extremely specific error I'm getting.
Typescript version: 4.9.5
Node version: v16.17.1
NPM version: 8.15.0
The text was updated successfully, but these errors were encountered: