Plotting A Circle; Plotting A Circle - Epson FX-80 User Manual

Hide thumbs Also See for FX-80:
Table of Contents

Advertisement

~-
c--
-- -
---
-r-- r--
I
r-- r--
1--
- -
-
~-.
~
r-- r-- -r--
-
- -r--
+
(, 1
~
~
.,/
-f-
(11 ,1 )
D.,/
.,/
+-
D
=
J(19:"
11)2
+
(7 - 11)2
=
,[8'+ (-
4)2
I
=
v'64+16-
=
,J8U)
--
---c----
DI/
~
8.94
*"
10
,
1
r--
I
1
Figure 15·5. Plotting a circle.
Plotting a Circle
The cells of the array can be examined in any order; the following
program uses a row by row scan with two loops:
2~
FOR R=l TO N: FOR C=l TO N
At each cell, the distance is calculated with:
Next we compare this distance with the desired radius of the circle
(10). If the distance to the current cell A(R,C) is close to 10, we set its
contents equal to one; otherwise, we leave it alone.
4~
IF
INT(D+.5)=1~
THEN A(R,C)=l
Line 40 sets any cell whose distance is between 9.5 and 10.5 equal to
one.
The final step to plotting a circle in the array is to close the loops and
display the contents of the array. Add two lines to your program:
171

Advertisement

Table of Contents
loading

Table of Contents