-
Notifications
You must be signed in to change notification settings - Fork 23
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
Better circle drawing algorithm #7
Comments
Current implementation is here: Line 163 in 7884b85
|
I have been playing with making a better algorithm the last couple of days. Mine could use some more optimization, but as it is it isn't too much slower than the current one. It completely fills in the circle and so far shows no problems with being absurdly slow or not filling properly. When it only draws the circle outline it is sometimes thicker than necessary by a pixel in places, though it is only noticeable if you look close. My fork with the changes is here: https://github.com/potato-programming/GameZero.jl/blob/master/src/screen.jl |
Yeah, the current implementation is pretty poor, so anything else is probably an improvement. I'd be really happy to see a PR. It'd be good to get a sense of how fast the new method is, using |
I used @time, and one implementation was in fact 10x slower, but I managed to get it working quite a bit better. The current one seems to be about 2 - 3x slower, which isn't too bad. |
I have tested the algorithm as a custom function is a game program, but I have been unable to test it as a function that is inside the GameZero module because of issues with the current way that the game is run. I am going to try and install my version as a custom package to test it, I will send a PR when I have done all necessary testing. |
There are still some bugs when |
The current algorithm for drawing circles is not very good (though it is fast). It looks pretty ugly if the cirle is more than a about 10 pixels in diameter.
The text was updated successfully, but these errors were encountered: