`Draw Polygon And Bullet'
Draw a polygon of a given graylevel, with a bullet
(black dot) at an indicated location. The polygon
coordinates are read in by this command, as are
the graylevel and the location of the bullet.
Variables used:
.black.
.white.
Input data read:
line 1:
A code (which is ignored) and a graylevel
to draw the polygon with. The value for this
graylevel ranges from .black. (which codes
to black ink on the paper) to .white.
(which codes to blank paper).
line 2:
An (x,y) location for the bullet.
line 3:
Skipped.
line 4-n:
Locations of vertices of polygon, ended with a blank line.
{
read .code. .graylevel. # Read line 1
read .x. .y. # Read line 2
skip # Skip line 3
read columns x y # Read a polygon
# Adjust .graylevel. to range between 0
# (for black ink) and 1 (for white paper),
# then set graylevel and draw polygon.
.graylevel. = {rpn .graylevel. \
.black. - .white. .black. - /}
set graylevel .graylevel.
draw curve filled
# Draw black bullet
set graylevel 0
draw symbol bullet at .x. .y.
# Clean up local storage.
delete .code.
delete .graylevel.
delete .x.
delete .y.
}