Star Micronics Radix User Manual page 164

Table of Contents

Advertisement

150
Radix User's Manual
What the program
section
starting
at line
600
actually
does is
to calculate
starting
and ending
points for a line (in our circle the
"lines"
are very short-sometimes
the starting
and ending
points
are the same). The coordinates
of the starting
point of the line are
assigned
to variables
Xl
and Yl.
The line ends at point X2,Y2.
When these coordinates
have been calculated,
a subroutine
call is
made to line 270. This
subroutine
calculates
the coordinates
of
individual
points
along that line.
After these coordinates
have been determined,
the subroutine
at line 400 is called.
This routine
turns "on" an individual
dot in
our array called
BIT%.
(Keep in mind that no printing
has been
done yet; the computer
is still drawing
the image
on its "graph
paper"
in memory.)
The way an individual
dot is turned
on is
using the logical
OR function
in line 470.
When
all the points
have been
plotted
in memory,
printing
begins
at line 150. We first set the line spacing
to 6/72 inch using
the
(ESC)
"A" command.
This
is so that there
are no gaps
between
rows
of dots. Then
the loop from line 170 to line 240
prints the dot graphics
image one line (which is six dots high) at a
time. The variable
A$ is used to build a string of all the columns
of
BIT%
in a given row.
As you can see, by taking
the program
in small pieces
and
analyzing
it, graphics
programming
does not have to be difficult.
If you want to try some other plots, try these (replace
lines after
600 with the lines below).
The printouts
from each program
are
shown
below the listing.
600 '
610 'Subroutine to plot a star.
620 '
630 RAD = 9
640 FOR ANGI = 0 TO 360 STEP 45
650 RANG = ANG% *
3.14159
/ 180
660
RANG2 = (ANG% +
135)
*
3.14159
/ 180
670 Xl = RAD * COS(RANG) + 10
680 Yl = RAD * SIN(RANG) + 10
690
X2 = RAD * COS(RANG2) + 10
700 Y2 = RAD * SIN(RANG2) + 10
710 GOSUB 270
720 NEXT ANGX
730 RETURN

Advertisement

Table of Contents
loading

Table of Contents