RosettaCodeData/Task/Archimedean-spiral/FreeBASIC/archimedean-spiral.basic
2023-07-01 13:44:08 -04:00

25 lines
757 B
Text

' version 16-10-2016
' compile with: fbc -s gui
Const As double deg2rad = Atn(1) * 4 / 180 ' pi = atn(1) * 4, pi/180
Const As UInteger screensize = 600 ' size of window in pixels
Const As Double turns = 5 ' number of turns
Const As UInteger halfscrn = screensize \ 2
Const As uinteger sf = (turns * (screensize - 100)) / halfscrn
ScreenRes screensize, screensize, 32 ' screen 600 * 600 pixels, 4 byte color
Dim As Double r, x, y
For r = 0 To turns * 360 Step 0.05
x = Cos(r * deg2rad) * r / sf
y = Sin(r * deg2rad) * r / sf
PSet(halfscrn + x, halfscrn - y), RGB(255, 255, 255)
Next
' empty keyboard buffer
While InKey <> "" : Wend
Print : Print "hit any key to end program"
Sleep
End