Post by druck Post by Richard Ashbery
I have a very old but interesting BASIC graphic program where
I've made some minor changes to operate on a 1920 x 1080 res
After program is run for some minutes it errors with "Accuracy
lost in Sine/Cosine/Tangent".
How do I stop this error from appearing?
If you are continually incrementing an angle which gets used in
SIN/COS/TAN, take a modulus to prevent it getting to big.
e.g. If you are incrementing angle variable 'a' degrees
a = (a + 1) MOD 360
Or for radians.
a = (a + 0.01) MOD (2*PI)
I've submitted the program for your perusal. The idea is quite simple
but I can't get my head round the programming :-(
REM - Tuttle: A pattern-drawing screen turtle
REM Refer to pages 29-33 in BBC Micro Programs in BASIC
REM original by Derrick Daines.
REM S = # of sides, D = # of sides before breakaway,
REM I = Breakaway angle, SIZE = pattern diameter
MODE 1920,1080,32 : OFF
S=8 : D=7 : I=3 : SIZE=300
FOR TURN=1 TO S
FOR SIDE=1 TO D
X1=SIZE*COS A:Y1=SIZE*SIN A
Program creates a partial octagon i.e. only 7 sides are drawn. The
finish of the last octagonal line (the breakaway point) becomes the
start position for the next partial octagon to create a simple
pattern. At the next 'TURN' the pattern is repeated but offset further
from the screen centre. If the program is permitted to run for a
longish period some fascinating effects evolve which cycle c/w and
I can't see a way of easily using a=(a+0.01)MOD(2*PI) without
upsetting the subtle patterning. If you get time have a look at it and
see if you can come up with a solution guys. I would welcome other