-
Notifications
You must be signed in to change notification settings - Fork 144
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
Stroke tessellator seems to produce wrong results for some rounded path types #891
Comments
Thanks for filing this and providing a test case. I'll have a look soon-ish. |
I was able to find a potentially simpler test case where the bug is more apparent:
The edge case in question seems to be when the segment lengths are short compared to the stroke width. If I had to guess what was going on, it would be that, based on the fact that each path segment is effectively two circles joined by a rectangle, the tessellation algorithm may be assuming that the inner corner between two path segments is at the intersection between two line segments. If so, I believe the bug would trigger if the inner corner is instead at the intersection between two circles (and possibly also at the intersection between a line segment and a circle). |
Yes indeed. With the cli app you can visualize the issue fairly easily by pressing |
Thanks for the tips. I didn't realize those controls existed; that makes things a lot clearer! I originally encountered this when playing around with a modified version of Lavagna (https://github.com/alepez/lavagna). It doesn't seem to come up that frequently in practice when using the program normally (rather than testing its limits), so I won't be disappointed if this takes a while to fix, especially given how tricky it is, and especially since I can work around it by just splitting the path if necessary (at the cost of some efficiency loss due to overlap). Just to double-check, do you know if there are any workarounds that the Lyon library provides? For instance, is "converting the stroke to a fill" a feature that exists in Lyon, or is it just presented as a possible algorithm? |
Lyon doesn't provide a workaround currently. I have a work in progress stroke-to-fill implementation here: https://github.com/nical/misc/blob/master/path_renderer/core/src/stroke.rs#L134 which you can copy into your own project, the intent is that it will make it into lyon but it's not quite ready and I currently don't ave a lot of time to spend on it. |
In the
main
branch (commit 2407b7f), running the following in the "cli" directory produces incorrect results:Since the path has a bounding box of 5x3 and a stroke width of 100, it should end up producing a blob, which it does. However, the blob also has a spike protruding out of it, which I believe is a bug.
I don't have much familiarity with how the tessellator works, so I don't have a lead on what the root cause is or how feasible this would be to fix.
The text was updated successfully, but these errors were encountered: