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

Arc Algorithm based on Bresenham Circle routine #2599

Open
MaBecker opened this issue Jan 16, 2025 · 2 comments
Open

Arc Algorithm based on Bresenham Circle routine #2599

MaBecker opened this issue Jan 16, 2025 · 2 comments

Comments

@MaBecker
Copy link
Contributor

This coding looks very promising to me, What do you think @gfwilliams ?

source: https://www.scattergood.io/arc-drawing-algorithm/
formated and copied to https://gist.github.com/MaBecker/071ca5440565dc9163a8e35a0cf2c5fc

@gfwilliams
Copy link
Member

Thanks - what's the use case for this out of interest?

My concern is that if it goes in, it will only be able to be for some boards - some of them like the original Espruino that are too tight on flash storage will have to leave it out.

... And we do already have drawEllipse: https://github.com/espruino/Espruino/blob/master/libs/graphics/graphics.c#L532

I think it got mentioned in a post on the forum, but if difference between start and end angles is less than 180 degrees it should be possible to implement it just using drawEllipse (which I believe uses the same algorithm) and then just setting the clipRect, which feels like it would only add 100 bytes max and could probably be kept in for all boards...

@MaBecker
Copy link
Contributor Author

MaBecker commented Jan 16, 2025

there is no use case at the moment. Was interested in how to draw arcs and because of this post: https://forum.espruino.com/comments/16966259/
I will work on this and let you know about the size. A js version that use poly would be nice too. Will talk to @muet (allobjects) about this. If I remember correctly he has a js version of gauges which is not part of the ui at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants