DRAW AN ARC
Popular Computing Weekly, 12.May'83

Ian Logan explains some of the mysteries contained in DRAW command

There have been several requests in Popular Computing Weekly for an
explanation to the phenomenon of the very attractive patterns produced by
using the DRAW command with high "angles of turn" (for the best introduction
to this see Nick Wilson's article, January 20-26 1983).

Patterns are produced as follows, eg:
	PLOT 50,50: DRAW 50,50,9999
which produces the pattern labelled Figure 1. So, just what is going wrong to
give a pattern rather than a "curved line"?

Well, the answer lies in the programmer failing to take the "angle of turn"
MOD 2*PI - that is, using the "remainder" after dividing by 2*PI. And, indeed
a curve is produced by:
	PLOT 50,50: DRAW 50,50,9999-2*PI*INT (9999/(2*P1))

For the best patterns the number of arcs is 252 (the limiting value in the
ROM program), as the pattern is built up by drawing a series of arcs. In the
example  DRAW 50,50,9999  the first arc is much too long and the succeeding
251 arcs continue with the "hunt" for the destination with an equal lack of
success.

In order to show just how these patterns are produced, I have written the
Draw An Arc program. This is a BASIC program that closely follows the
algorithm used in the DRAW routine of the Spectrum ROM. By having it in
BASIC, the user is able to see a pattern developing slowly and can use the
BREAK key to modify the program easily. Indeed, by adding the line:
	65 LET G=G-2*PI*INT (G/(2*PI))
the patterns are abolished as predicted.

The variable labels M0-M4 refer to the calculator's memory area and the
variable label SC to the machine stack. Figures 2-4 show a range of patterns
produced by this program.

