Issue #1760
Posted: Sat Jan 22, 2022 11:43 pm
I've noticed this issue: https://github.com/love2d/love/issues/1760
I'm not on GitHub so I can't comment there, but I wanted to note that this is a problem with the default "miter" line join algorithm. The line drawing algorithm tries to draw a miter, but when there are duplicate points, doing a miter implies that the edges of the line at the joint would be parallel. See what happens when they are almost parallel:
In an 800x600 window, the miter extends well to the left of the centre of the screen, where the central point is located.
All three test cases work just fine after setting the line join to none:
I don't think this is really a bug, but hinting at the line join as the culprit in the issue would probably help people work around it. If it's considered a bug, perhaps the solution would be to internally switch the line join to "none" for the vertices where the miter angle gets too extreme.
I'm not on GitHub so I can't comment there, but I wanted to note that this is a problem with the default "miter" line join algorithm. The line drawing algorithm tries to draw a miter, but when there are duplicate points, doing a miter implies that the edges of the line at the joint would be parallel. See what happens when they are almost parallel:
Code: Select all
function love.draw()
love.graphics.setLineWidth(2)
love.graphics.line(750, 300, 400, 300, 750, 303)
end
All three test cases work just fine after setting the line join to none:
Code: Select all
love.graphics.setLineJoin("none")
function love.draw()
love.graphics.line(0, 0, 100, 100, 100, 100) -- a
love.graphics.line(10, 0, 60, 50, 60, 50, 110, 100) --b
love.graphics.line(20, 0, 70, 50, 120, 100, 70, 50) -- c
end