-
Notifications
You must be signed in to change notification settings - Fork 150
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
polylabel hanging with degenerate case #51
Comments
Would this work?
|
See #81 for a suggestion to use an initial single cell that contains the entire polygon instead of tiling by cells sized by the shortest dimension of the bounding box. That would address this specific issue, as your However, you also raise a good point about selecting an appropriate precision. In my implementation, I set the precision to one thousandth of the shortest side of the bounding box. And that would bring us right back around to your bug in the face of degenerate polygons. :) For bullet-proofing your code, it seems like it would make sense to intercept polygons with sides too short to proceed. In this case, perhaps just return the bounding box center. So how short is too short? I guess that would depend on how much exponent you have (that is, whether you use My code has no such safeguards, but now I'm thinking it should. |
See #83 for a follow-up discussion on automatically setting precision. |
@mourner it's scary to see no tests added for these fixes 🫣 |
@TWiStErRob these are pretty trivial fixes and there were no test cases provided in the issues, so I didn't want to spend too much time on them, but if you want to add some tests, PRs are always welcome! |
A user added a polygon to my system that is a degenerate case. This causes function
polylabel
to spin forever. The polygon has almost no height at all, causing a minuscule height on this line:height is 4.97e-14 and width is 0.0017.
This causes the following for loop to spin for a very long time:
Precision is set to 1.0. Shouldn't
cellSize
be bounded in minimum size by the precision somehow?The text was updated successfully, but these errors were encountered: