-
Notifications
You must be signed in to change notification settings - Fork 58
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
More infinite looping in CircularLinkedList (for v1.2.10) #55
Comments
- unify is working after scaling of coordinates, subtract is not working yet
Still working on it |
Do you have any suggestions on which types of polygons we should be avoiding so that we can avoid the infinite looping while you are working on this issue? |
@alexbol99 Any chance of getting PR #56 merged? I'm currently using that branch on a webserver to avoid this bug crashing the webserver... @jovankrajevski In case it's useful: you can use the branch for PR #56 from npm with |
I would prefer to see PR #56 merged tbh. imo it is better to have an error thrown, so that we could fall back on some other heuristic, than have the browser/server looping forever. |
I would not fix it in this way. The reason of infinite loop is illegal merge of two polygon caused by numeric errors. I know how to prevent it in the way that it throw error before it comes to infinite loop. It just takes me some time to implement. Sorry for delay. |
Operation is stable when polygon has no almost zero length edges. Intersection between two edges when one of them is big and other has length closed to zero is numerically unstable. Try to filter your polygons from tiny edges that have no meaning, and the result will be fine. |
@alexbol99 thanks. I actually solved my problem by just casting the coordinates to ints, but I will make sure that I do not have edges with length < 1. I am not sure if you are aware that this bug happens sometimes with floating point coordinates, and not just with edges that are really small, so I just wanted to point that out. |
@jovankrajevski , @OliverColeman |
Awesome, thanks for this :). I am wondering if it would be even better to put that code into CircularLinkedList.js rather than face.js? At the moment face.js is the only code that uses CircularLinkedList, but if in the future some other code uses it and causes an infinite loop, it would still be caught. |
Some examples: https://codesandbox.io/s/flatten-js-infinite-loop-181sh?file=/src/index.ts
The text was updated successfully, but these errors were encountered: