Skip to content
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

Unexpected behavior of love.graphics.line with duplicate points #1760

Closed
megagrump opened this issue Jan 3, 2022 · 4 comments
Closed

Unexpected behavior of love.graphics.line with duplicate points #1760

megagrump opened this issue Jan 3, 2022 · 4 comments
Labels
bug Something isn't working
Milestone

Comments

@megagrump
Copy link
Contributor

megagrump commented Jan 3, 2022

function love.draw()
	love.graphics.line(0, 0, 100, 100, 100, 100) -- a
	love.graphics.line(0, 0, 50, 50, 50, 50, 100, 100) --b
	love.graphics.line(0, 0, 50, 50, 100, 100, 50, 50) -- c
end

I would expect all of these calls to draw a line from 0, 0 to 100, 100, but neither of them do.

a and b draw nothing. c draws a line from 0, 0 to 50, 50.

function love.draw()
	love.graphics.line(100, 100, 100, 100)
end

Since line coordinates are endpoint-inclusive, I think this should draw a single point at 100, 100.

Funny backstory: I wasted a considerable amount of time trying to find a bug in a routine that builds a huge graph; turns out all the nodes were actually connected, but some of the lines in the visualisation had duplicate points like this.

@slime73 slime73 added the bug Something isn't working label Jan 3, 2022
@slime73
Copy link
Member

slime73 commented Jan 3, 2022

For reference, there's a bit of discussion about this in #972. However I haven't decided yet if the same stance should be taken as in the original issue so I might leave this open.

@radgeRayden
Copy link

I think especially when we're talking about arbitrarily generated lines, it would be very nice to have a more resilient line drawing function, and in particular the expected behaviour of drawing a point if start and end are the same simplifies things a bit (for the end user). Maybe it is unexpected for other people, though.

@slime73
Copy link
Member

slime73 commented Jan 23, 2022

pgimeno did a bit of investigation into the problem, here: https://love2d.org/forums/viewtopic.php?f=3&t=92555

@slime73
Copy link
Member

slime73 commented Sep 19, 2022

This is fixed as of 6b54ee5 (part of love 12, although we could backport the fix I suppose if we end up releasing a new 11.x version).

@slime73 slime73 closed this as completed Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants