No trigonometry, no exponents, and this seems to produce less "wobbly" circles than the DRAW fuction. Replace the Line( commands with simple points if you want hollow circles instead.
Code: PROGRAM:CIRCFILL
:Prompt A,B,C // x-pos, y-pos, radius
:DelVar UC→V
:1-Ans→I
:-2C→J
:Repeat U>V
:Line(A+U,B+V,A-U,B+V
:Line(A+U,B-V,A-U,B-V
:Line(A+V,B+U,A-V,B+U
:Line(A+V,B-U,A-V,B-U
:I≥0→T
:I+JAns+(2U+3)not(Ans→I
:J+2T+2→J
:U+1→U
:V-T→V
:End
Source: http://en.wikipedia.org/wiki/Midpoint_circle_algorithm
Now I can draw phalli on school calculators 10x faster!
Good stuff, Weregoose! I imagine the window has to be set to the 0,94 0,63 stuff in order for it to look right?
Is that the Bresenham Circle Algorithm, or something that you came up with independently?
merthsoft wrote:
Good stuff, Weregoose! I imagine the window has to be set to the 0,94 0,63 stuff in order for it to look right?
0,62, but yes. A workaround with ΔY would be possible.
KermMartian wrote:
Is that the Bresenham Circle Algorithm, or something that you came up with independently?
It's Bresenham's—the source is given under my code block.
So it is, and now I see that it matches Bresenham's. It's pretty ingenious to use that to draw filled circles; I don't know if anyone had previously thought of that application, at least in the community.
KermMartian wrote:
I don't know if anyone had previously thought of that application, at least in the community.
I'm not sure if there are any other well-known ways to fill circles - are there? The only issue is that it can result in overdraw, which is a problem if you're using an inverting (EOR) plotting operation.
I was just looking to see if anyone had thought of something like this. I made one myself that is similar to this but I did not know anythng about Bresenham Circle Algorithm. It was just common sense. I'll let you compare if you'd like.
basicman wrote:
I was just looking to see if anyone had thought of something like this. I made one myself that is similar to this but I did not know anythng about Bresenham Circle Algorithm. It was just common sense. I'll let you compare if you'd like.
Sure, you might as well post up your code. Perhaps we'll even have some optimization tips for you!
what does the comman prompt do?
Sorunome wrote:
what does the comman prompt do?
I don't follow how your question is relevant to this topic; can you please elaborate?
http://tibasicdev.wikidot.com/prompt
There should be a "Let Me TIBD That for You" site.
Ohhh, he was asking what the command "Prompt" was for; nice job decoding that, Merth. I thought he was asking what the "command prompt" was for, and I was lost.
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.
»
Go to Registration page
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum