Closed Cardosaum closed 1 year ago
Thanks for the PR! This mostly looks good, but I think we are over drawing some pixels here due to doing both horizontal and vertical lines.
Its possible to do this with only horizontal lines. This post explains a way to do it: https://stackoverflow.com/questions/5607946/bresenhams-circle-algorithm-filling-question using the same algorithm, Bresenham Circle.
Thanks for pointing out the algorithm you were using, it was really helpful!
I optimized the code as you said, now we're only painting pixels once per loop instead of having overlapping ones as previously observed.
I also made a small change in circle
function, removing some unnecessary type coercion.
Closes #5.
The main logic for the
circle_filled
was shamelessly borrowed fromcircle
function. There might be room for optimization, but curious to know what would be your take on this.