circle-2functions

=How to draw a circle using 2 different functions=

code format="vb"  ' ' How to draw a circle : 2 functions by Pierre and Alix ' ' Yesterday my son was teaching me some Geometry. While he was explaining the ' formulas, I would translate them in Just Basic. Then we went on to try all ' sorts of things, what if we did this....and seing the result immediately ' in JB's graphic window. So much fun!!! :-) '    nomainwin    WindowWidth=400    WindowHeight=400    UpperLeftX=Int((DisplayWidth-WindowWidth)/2)    UpperLeftY=Int((DisplayHeight-WindowHeight)/2)    graphicbox #1.g, 0,0,400,400    open "circle" for window_nf as #1

#1, "trapclose [exit]"

#1.g "size 5" #1.g "down" call drawcircle1 50, 100, 80 call drawcircle2 50, 200

#1.g, "flush" wait

[exit] close #1 end

' ' DRAW CIRCLE 1 ' sub drawcircle1 r, placex, placey for a=1 to 360 angle=(a/57.2957) x = r*cos(angle) y = r*sin(angle) #1.g "set ";x+placex;" ";y+placey call goslow 10 next a end sub ' ' DRAW CIRCLE 2 ' sub drawcircle2 r, center minusR=r*-1 for y=minusR to r           x=SQR((r*r)-(y*y)) #1.g "set ";x+center;" ";y+center x=x*-1 #1.g "set ";x+center;" ";y+center call goslow 10 next end sub ' ' PAUSE ' Sub goslow mil timer mil, [cont] wait [exit] close #1 end [cont] timer 0 End Sub

code