`rem`

rem Circle test, question posed by J at Naalaa 2015-04-19 1.39 AM to B+

rem first B+ had to see what pixel procedure expects x,y are integers

rem ah B+ also sees Naalaa lacks a circle function for crying out loud!

rem so good idea to make a reusable procedure here

sq=450

set window 0,0,sq,sq

rem origin

x0 = int(sq/2)

y0 = int(sq/2)

for r=200 to 225

proc circle x0,y0,r

next

r=200

do

proc circle x0,y0,r

r=r-25

until r<=10

for r=0 to 25

proc circle x0,y0,r

next

x1=int(x0/2)

for r=0 to 20

proc circle x1,x1,r

next

x2=x0+x1

for r=0 to 20

proc circle x1,x2,r

next

for r=0 to 20

proc circle x2,x1,r

next

for r=0 to 20

proc circle x2,x2,r

next

wait keydown

end

procedure circle(x,y,r)

i#=0.0

do

rem set up x,y as integers for set pixel call with just integers to add

xpos = int(sin#(i#) * float#(r))

ypos = int(cos#(i#) * float#(r))

rem float#(r) converts integer 200 to decimal 200.0? yeah

rem that way the entire line is a decimal calculation? yeah good for rounding errors

set color 255,0,0

rem ... and the int() converts the decimal into an integer? yeah

rem so that the entire line would be an integer calculation? now next line has 0 floats to deal with

draw pixel xpos+x,ypos+y

i# = i# + 0.2

rem so... using 360.0 or float#(360) is correct? yeah probably gives smoother circle

rem whereas using only 360 will cause an error because

rem i# is decimal and 360 is integer?

rem ... my brain hurts ...

rem yeah 2.04 AM now for me too! I like incrementing by .something but .1 is really too fine? try .5 first

until i# >= 360.0

endproc