Logarithmic spiral
Posted: Mon Jan 02, 2017 8:49 pm
A logarithmic spiral, derived from the code for Archimedean spiral viewtopic.php?f=20&t=1696
Code: Select all
'Logarithmic spiral, in polar coordinates
'by Dutchman, january 20
' --- constants
dphi=0.1 ' angular increment
a=0.1
b=0.1
GET SCREEN SIZE sw,sh
x0=sw/2 ! y0=sh/2
size=MIN(x0,y0)
' --- initiate graphics
GRAPHICS
GRAPHICS CLEAR 1,1,0.5
DRAW COLOR 1,0,0
DRAW SIZE 2
' --- initiate
DRAW TO x0,y0
' --- loop
DO
r=a*EXP(b*phi)
z=r*EXP(1i*phi)
DRAW LINE TO x0+REAL(z),y0-IMAG(z)
phi+=dphi
UNTIL ABS(z)>size
END