-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Improved algorithm for mitre joints on thick lines #2518
Conversation
Merged this now, thank you!
It would be interesting to see what it would take to make this modification. Logs from rough perf measurement system (not very precise!)
|
An update on this can be found here: (TL;DR; this PR did partially fix an earlier regression from Jan 2019 but we somehow still carried part of that regression even after April 2019) |
The current implementation for rendering thick lines suffers from issues when the lines meet at extreme angles. A 90-degree bend will cause the thickness of the line to contract by around 30%. In the case of a rectangle, this causes the entire rectangle to be the wrong thickness:
I've modified the algorithm to counteract this effect by placing the mitre vertices at a distance that preserves the correct thickness. The new algorithm works for vertices up to 90-degrees; past that, it would be impossible to fix without actually inserting new vertices. Seeing as rectangles are by far the most common UI element, this seems an acceptable compromise.