Does anybody know how to draw a 1/4 of a circle on the graphscreen?
A filled-in 90° arc positioned A pixels to the right of and B pixels above the origin, of pixel radius C, and with zero eccentricity regardless of the axes' aspect ratio, can be drawn with this variation on the midpoint circle algorithm:
:DelVar UC-1→V
:1-Ans→I
:-2V→J
:Repeat U>V
:ΔX(A+U:Line(Ans,BΔY,Ans,ΔY(B+V
:ΔY(B+U:Line(AΔX,Ans,ΔX(A+V),Ans
:I≥0→T
:I+JAns+(2U+3)not(Ans→I
:J+2T+2→J
:U+1→U
:V-T→V
:End
Thanks, Weregoose, I can definitely apply this elsewhere! I am curious if you know of a way to draw arcs of arbitrary sizes using a similar algorithm?
Z80 Assembly>English>TI-BASIC>Python>French>C>0
Maybe this can help:
For(I,0,.49π,.01π
Line(P+Rcos(I+A),Q+Rsin(I+A),P+Rcos(I+.01π+A),Q+Rsin(I+.01π+A
End
A is the rotation.
Sunrise 3 Progress: 30%
Size: around 20 KB, not including the save lists and in-game RAM.
I tried bluebear's program and all I got was a vertical line on Xmax; it didn't matter the window dimensions.
I edited it. See above.
Sunrise 3 Progress: 30%
Size: around 20 KB, not including the save lists and in-game RAM.
Also make sure your calculator is set to radians, not degrees.
Timothy Foster - @tfAuroratide
Auroratide.com - Go here if you're nerdy like me
Yay, a program for a filled circle now! Although it works only for no rotation…
For(I,Q,Q+R,ΔX
Line(P,I,P+R√((P-I)²-R²),I
End
This uses rotation:
For(I,0,.5π,K
Line(P,Q,P+Rcos(I+A),Q+Rsin(I+A
End
You need to specify a K small enough to draw a circle properly.
Sunrise 3 Progress: 30%
Size: around 20 KB, not including the save lists and in-game RAM.