User's Manual

Figure
13-5.
Plotting a circle
Circle Plotting
You can have your program examine the cells of an array in any
order; the following program scans them row by row, using two
loops:
20 FOR R=1 TO N: FOR C=1 TO N
At each cell, line 30 calculates the cell’s distance from a center point by
using the distance formula:
30
D=SQR((R-11)^2+(C-11^2)
Next the program compares this distance with a number
(10)
that
specifies the radius of a circle. Notice that this formula commonly
results in a number that includes a decimal fraction, e.g.,
8.94.
If the distance for the current cell A(R,C) is close to 10, you set its
contents equal to one: otherwise, you leave it alone.
40
IF INT(D+.S)=10 THEN A(R,C)=1
Line
40
sets any cell whose distance is between
9.5
and 10.5 equal
to one.
177