Closed ayshih closed 1 year ago
Sorry for the noise! It turns out this "bug" is simply a difference in choice when there are two pixels equally close to the line. This change is not necessary.
@ayshih , thanks for the interest and the thoughtful analysis!
The implementation of Bresenham's line algorithm used for
get_pixels_on_line()
has a bug because it uses>
instead of>=
and<
instead of<=
. Compare against the final code example in this section on the Wikipedia article: https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm#All_cases. ~This bug means that the pixels other than the closest ones are occasionally chosen.~Edit: After further investigation, it appears that the difference in comparison operator simply means a different choice is made when two pixels are equally close to the line. After I confirm, I'll close this PR as an unnecessary change.