Epson FX-80 Specifications Page 194

  • Download
  • Add to my manuals
  • Print
  • Page
    / 268
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 193
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=l TO N: FOR C=l 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+.0)=l0 THEN A(R,C)=l
Line
40
sets any cell whose distance is between
9.5
and 10.5 equal
to one.
177
Page view 193
1 2 ... 189 190 191 192 193 194 195 196 197 198 199 ... 267 268

Comments to this Manuals

No comments