Polyspiral: Difference between revisions
Content added Content deleted
(Added XPL0 example.) |
(Polyspiral in FreeBASIC) |
||
Line 539: | Line 539: | ||
} |
} |
||
}</lang> |
}</lang> |
||
=={{header|FreeBASIC}}== |
|||
<lang freebasic>#include "fbgfx.bi" |
|||
#if __FB_LANG__ = "fb" |
|||
Using FB '' Scan code constants are stored in the FB namespace in lang FB |
|||
#endif |
|||
#define pi 4 * Atn(1) |
|||
#define Deg2Rad pi/180 |
|||
Dim As Integer w = 900, h = w |
|||
Screenres w, h, 8 |
|||
Windowtitle "Polyspiral" |
|||
Dim As Integer incr = 0, angulo, longitud, x1, y1, x2, y2, N |
|||
Do |
|||
incr += 1 |
|||
x1 = w / 2 |
|||
y1 = h / 2 |
|||
Pset (Fix(x1), Fix(y1)) |
|||
longitud = 5 |
|||
angulo = incr |
|||
For N = 1 To 150 |
|||
x2 = x1 + longitud * Cos(angulo * Deg2Rad) |
|||
y2 = y1 + longitud * Sin(angulo * Deg2Rad) |
|||
Line - (Fix(x2), Fix(y2)), N+16 |
|||
x1 = x2 |
|||
y1 = y2 |
|||
longitud += 3 |
|||
angulo += incr |
|||
Next N |
|||
Sleep 500 |
|||
Cls |
|||
Loop Until Multikey(SC_ESCAPE)</lang> |
|||
=={{header|Fōrmulæ}}== |
=={{header|Fōrmulæ}}== |