-
Notifications
You must be signed in to change notification settings - Fork 64
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
Error creating unnecessary hole on union #57
Comments
Hi @rowanwins thanks for bug report Are you thinking it would better for the output polygon to have one bow-tie shaped hole, instead of two holes that touch at one point? Right now the logic that forms the output favors making two rings instead of one ring that self-intersects. Is that what you're referring to or am I on the wrong track? |
This is what I would've expected to get back, hope that helps clarify. |
As some bonus context, I've been writing a buffer module, under the hood I'm using |
Ah, gotcha, I see what you mean. Yeah I can see how the current behavior isn't right for that situation. I'm trying to think of a counter example of where the current behavior would be the desired behavior... so far no success. |
Yeah I suspect the proposed is more common, I can't think of a case where you'd want to retain those holes. As an aside one thing I've done elsewhere is setup tests which run against more established spatial libs, in particular |
I think this is a case of where the non-zero rule and the even-odd rule differ. Basically, I think to count this area as inside the polygon, this lib should swtich from using the even-odd rule to the non-zero rule. Which sounds ok to me, I would agree that I think most if not all users of the lib would expect that area to be filled in your example. I'd consider this to be a backwards-incompatible change since it is changing behavior that is documented in the README. |
A few tentative implementation plan notes:
|
The SVG standard defaults to non-zero rule for filling polygons as well, this lib should probably mirror that behavior as this ticket suggests |
work progressing on this branch: https://github.com/mfogel/polygon-clipping/tree/feature/non-zero-rule |
Hi @mfogel
So I've encountered a new issue when union-ing a single polygon.
The polygon crosses over itself and should result in a single hole.
However it is resulting in two holes, the second of which is not required.
Grrr don't you hate edge cases :)
The text was updated successfully, but these errors were encountered: