-
Dutchman
- Posts: 851
- Joined: Mon May 06, 2013 9:21 am
- My devices: iMac, iPad Air, iPhone
- Location: Netherlands
- Flag:
Post
by Dutchman »
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
- logarithmic spiral.PNG (87.69 KiB) Viewed 2496 times
Last edited by
Dutchman on Thu Jan 19, 2023 3:30 pm, edited 1 time in total.
-
rbytes
- Posts: 1338
- Joined: Sun May 31, 2015 12:11 am
- My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
- Location: Calgary, Canada
- Flag:
-
Contact:
Post
by rbytes »
Thanks, Dutchman.
The only thing that gets me down is gravity...
-
Operator
- Posts: 138
- Joined: Mon May 06, 2013 5:52 am
Post
by Operator »
I like this, so an animated version had
to be included...
Code: Select all
'Logarithmic spiral, in polar coordinates
'by Dutchman, january 2017
' --- 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
SPRITE 1 BEGIN sw,sh
SPRITE 1 END
' --- initiate
DRAW TO x0,y0
' --- loop
SPRITE 1 BEGIN
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
SPRITE 1 END
SPRITE 1 SHOW
'END
LOOP:
dang += 0.001
SPRITE 1 AT 0,0 ANGLE dang
GOTO LOOP
-
sarossell
- Posts: 195
- Joined: Sat Nov 05, 2016 6:31 pm
- My devices: iPad Mini 2, iPhone 5, MacBook Air, MacBook Pro
- Flag:
-
Contact:
Post
by sarossell »
I am getting sleepy..........
smart BASIC Rocks!
- Scott : San Diego, California