The POLYGON and POLYLINE statements generate variable sided polygons or circles. The pen starts and ends in the same position, and after execution the pen is up. The radius is the distance between the logical pen position and the polygon vertices where the first vertex is in the positive X axis direction. A negative radius will rotate the arc by 180 degrees. The PDIR statement can be used the specify the starting angle.
You can specify the number of chord segments in a full circle and the number to draw. By default there are 60 segments in a full circle. Here is an example of an arc and a circle:
POLYGON 10 !Circle with radius 10
POLYLINE 10,20,3 !Arc of 3/20ths circle
For the POLYGON statement, if the number of chords drawn is less than the specified total number of chords, the polygon closure is affected. If the pen is up when the POLYGON statement is executed, the polygon is closed by drawing the last vertex to the first vertex. If pen is down, the polygon is closed by drawing the last vertex to the center of the polygon and then drawing from the center to the first vertex. The following program shows the difference:
10 GINIT
20 MOVE 35,50
30 POLYGON 10,10,8
40 MOVE 65,50
50 DRAW 65,50
60 POLYGON 10,10,8
70 END
For the POLYLINE statement, if the number of chords drawn is less than the specified total number of chords, the polygon is not closed. If the pen is up when the POLYLINE statement was executed, the first vertex is on the perimeter. If the pen is down when the POLYLINE statement is executed, the first point (logical pen position) is drawn to the first point on the perimeter. Change the previous program so that line 30 and 60 use POLYLINE statements. Execute the program again to see the effect of the pen being up or down.