-
Notifications
You must be signed in to change notification settings - Fork 657
Rings and keywords #289
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
Rings and keywords #289
Conversation
|
@DaveSprague you previously fixed our circle drawing algorithms (twice actually). Can I invite you to take a look at these suggested improvements as well? |
|
That would be good because I figured out the ring algorithm more or less by guessing. However, it is relatively efficient, only one row of pixels is painted twice. |
|
Sorry, it would be helpful if I knew what issue these changes are intended to fix? |
|
Or what improvements these changes are providing |
|
These updates fix the problem that circles with fillCircle () are one pixel taller than wide. In addition, there are now functions for filled circles and the possibility to have the circles optimized so that only quadrants that are on the screen are drawn. But I don't know if that doesn't have disadvantages anywhere. |
|
Here's my take having just looked over the code for a bit. I don't have a hardware setup to do any tests at this point but I'll try to do some testing on it in the next few days. It's not clear to me if there's much benefit of doing the "quads" optimization unless we have a use case that needs it where the performance gain is significant? It makes the drawCircle and drawFilledCircle code much more complicated and therefore more difficult to maintain. I do like the idea of being able to draw rings but I wonder if it's worth having a separate function to do that compared to drawing a filled circle and then drawing a smaller inscribed filled circle inside it using the background color. Another way to approach the issue in a more general way would be to have a version of the drawCircle algorithm, called drawArc, that, in addition to the center and radius, takes a starting and ending angle so that you can do arbitrary arcs of both non-filled and filled circles. The ring feature is what really got me thinking about this since having the ability to draw a "gas gauge" would be quite nice for visualizing certain quantities. Once you have the ability to draw arcs (non-filled, filled, and rings) with a start and stop angle, you also then have the ability to draw only the parts of the circle that are visible on screen if you want to optimize the performance along the lines of the quad feature. So my suggestion would be to limit the changes in this commit to be just the ones that fix the filled circle to have equal height and width -- it's really great that you caught that. Have you tested it for circles of radius 0 and 1?. Although I have a very limited experience contributing to open-source projects, I would think it makes sense to keep pull requests focused on fixing one or a very few and related bugs or adding one or a few related features. As a separate effort, perhaps you would like to look into adding drawArc and drawFilledArc functions that could be used to draw pie charts, gas gauges, etc. That's going to be significantly more complicated than the quad approach but it's a feature that's commonly supported in higher end graphics libraries and could be very useful for visualizing quantities on microcontroller/IoT applications. |
|
I tested it with different radii and it worked (for 0 I had to program a special case). |
|
I'm just noticing that the program is not compiling. Strangely, the program complains about an |
Really. I actually deleted this function when I just wanted to replace drawCircle, drawCircleQuads and fillCircle. Unfortunately, drawHorizontalLine was directly underneath, so I accidentally replaced this function.
|
Fixed it. |
|
Is there still something wrong? |
|
Thank you Dave for the excellent feedback!
👍 I was asking myself the same question.
👍 One function is enough
👍 Again, I agree - with both statements!
Absolutely. This one has a history 😜 #279, #280, #282, and #284 are all predecessors. @NoobTracker is getting familiar with authoring PRs. Kudos to your perseverance 👏 |
|
The fillCircle function is time consuming and if used twice it would paint over everything in a smaller circle, which is very unattractive for certain purposes. With a huge ring that takes up a lot of screens but is only very thin, it would take a long time to paint everything twice. |
|
Hi @NoobTracker, Also, you had mentioned making a race car game -- my impression is that this library is more targeted at simple IoT status display functions, etc. If you're main goal is using your code for a game where performance is the highest priority, you might consider using your own version of this library, tuned version of your game application and packaged with it, rather than trying to add those features into this code base which is not really targeted at high-performance game applications? Dave |
|
Oh no, Google Translate translated my text poorly. I wanted to say that this program has advantages if you have a large ring that is wider than the screen is wide. I use normal 128x64 displays. |
Correct, that's the hardware we target. |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
It should be a little better now.