Nodes

See all articles from CATS v3 n7b
Author(s): Roald Schrack
Publication: CATS Newsletter
Pub Details: CATS v3 n7b (Volume 3, Issue 7b)
Date: November 1985
Pages: 4

Here is a program that will draw regular polygons with all the diagonals. You choose the number of nodes and the size.

   5 DIM x(60)
6 DIM y(60)
10 PRINT "give scale ";
20 INPUT s
25 PRINT s
30 PRINT "give number of nodes ";
40 INPUT in
45 PRINT in
50 FOR i=1 TO in
60 LET z=2*PI*i/in
70 LET x(i)=4*SIN (z)+15
80 LET y(i)=4*COS (z)+8
90 NEXT i
100 LET im=in-1
110 FOR n=1 TO im
120 LET ip=n+1
130 FOR m=ip TO in
140 PLOT s*x(n),s*y(n)
142 LET dx=s*x(m)-s*x(n)
144 LET dy=s*y(m)-s*y(n)
146 DRAW dx,dy
150 NEXT m
160 NEXT n
170 STOP
give scale 12
give number of nodes 12
Twelve-node polygon with all diagonals
Twelve-node polygon with all diagonals

Roald A. Schrack

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.