Spirals in BBC Basic
Having seen how to program a circle
you are in a good position to produce spirals, in which the radius gradually
increases (or decreases) as the "polar angle" winds on beyond 360 degrees.
Our simple circle program is:
Circle
MODE8:OFF
ORIGIN 640,512
R=300
PLOT69,0,0
MOVE R,0
FOR t=0 TO 360
DRAW R*COSRADt,R*SINRADt
delay=INKEY(1)
NEXT
By just making two small modifications we get a nice ....
Archimedes Spiral
Polar Equation: R= a * t
where R is the radius, a is a constant and t
is total angle turned
MODE8:OFF
ORIGIN 640,512
MOVE 0,0
FOR t=0 TO 1440
REM 4 turns of the screw!
R=0.3*t
REM gradually increase the radius
REM in proportion to the total
angle turned
DRAW R*COSRADt,R*SINRADt
delay=INKEY(1)
NEXT
The Logarithmic Spiral
Polar Equation: log R = a * t
where R is the radius, a is a constant and t
is total angle turned
MODE8:OFF
ORIGIN 640,512
R=30
MOVE R,0
FOR t=1 TO 1440
REM 4 turns of the screw!
R=30*(1.002^t)
REM increase the radius
REM exponentially with angle
DRAW R*COSRADt, R*SINRADt
delay=INKEY(1)
NEXT
Paste these programs into "BB4W" to see them run. (Help is here)
Homepage