-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Fix line join artifacts with 180º or very sharp angles #4008
Conversation
…p nextNormal, limit to only miter cases
Currently checking to see whether these affect gl-native too, since I've modified render tests here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌
This does indeed need a gl-native parity PR: ticketed at mapbox/mapbox-gl-native#7778 and added ignores to line-join render tests. |
🙇 |
@aaronlidman sadly though this isn't the same as the line-offset issue you were seeing |
This fixes two separate (but in appearance seemingly related) 🐛s with line joins:
Miter line joins with 180º angles were evaluated to have
(NaN, NaN)
normal join vectors (e.g. a (1, 0) unit vector and a (-1, 0) unit vector add to (0, 0), whose unit vector is (NaN, NaN)). Because they weren't calculating extrusion vectors correctly these resulted in artifacts likeafter:
Miter and bevel line joins with very sharp angles and miter joins are evaluated via the "
flipbevel
" path: since the angle is so acute, the miter would be far too big, so we bevel it off instead. However, theflipbevel
path had a normal vector flipped, so the join's vertices were added in the opposite order expected for indexing and they were creating artifacts such as(Note: this explanation may not visually make sense, because with very sharp angles we add an extra vertex near the join (something about dashed lines; if you remove that vertex and ⏬ opacity you can see the incorrect triangle indexing:)
after:
This also includes some comment spellchecking 😬
I've added two lines to all of the line-join tests in the render suite: one that turns 180º, and one that turns very acutely. These now produce the following results (previously these tests only had the left three lines):
master
line-artifacts
(Turns out this bug wasn't actually ticketed 😬)
I'd like to get into #3809 / #2316 next (these are more or less the same issue, just applied to different join types), after I wrap up some other outstanding PRs — I dug just enough to know that those are pretty unrelated to ☝️.
Launch Checklist