Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An idea adopted from Earstrip. There's a trade-off to it, so I want to capture it as a PR but not sure it's worth the output churn plus worse quality for the small speedup.
After cutting an ear, earcut always moved on to
next, soprev(which just got a new corner) was only retried after a full lap, with lots of reflex corners hit along the way. This PR alternates betweenprevandnext. On the MVT tiles benchmark, ear-loop iterations drop from 5.84M to 4.00M, and time drops 6.4% (14% onwater-huge*).Tradeoff: more fan-like triangles. Across the tiles corpus, mean quality goes from 0.429 to 0.411, slivers increase 10%, and total edge length grows 5%. Output stays exact (zero deviation everywhere). This doesn't matter for fill rendering, and
refine()removes the difference completely (0.621 either way).I also tried always going to
prev, and retryingprevonce afternextfails. Both lose as much shape quality or more for about the same speed.Test changes: new triangle order in the README and
indices-*tests, slightly looser limits on the invalid fixtures (water-huge2,issue142,eberly-6), and the refine test's improvement limit goes from 10% to 5%.