Source Code
1 REM curve program
10 LET a=60: DIM x(20): DIM y(20): DIM b(20): DIM c(120): DIM d(120)
100 INPUT "total number of corners: ";g
110 LET n=g-1
120 INPUT "first coordinates: x=";x;" y=";y
130 FOR i=1 TO n+1
140 LET x(i)=x: LET y(i)=y
150 PLOT x,y: IF i=n+1 THEN GO TO 180
160 INPUT "next coordinates: x=";x;" y=";y
180 NEXT i
190 GO SUB 510
400 STOP
510 LET c(1)=x(1): LET d(1)=y(1)
530 FOR e=2 TO a-1
540 LET j=((e-1))/(a-1): LET b(1)=(1-j)^n
550 FOR i=1 TO n
560 LET b(i+1)=(g-i)/i*j/(1-j)*b(i)
570 NEXT i
580 LET c(e)=0: LET d(e)=0
590 FOR i=1 TO n+1
600 LET c(e)=c(e)+b(i)*x(i)
610 LET d(e)=d(e)+b(i)*y(i)
620 NEXT i
630 NEXT e
640 LET c(a)=x(g): LET d(a)=y(g)
650 INPUT "C)curve only F)frame & curve";z$
660 IF z$="c" THEN GO TO 710
670 FOR i=1 TO n
680 PLOT x(i),y(i)
690 DRAW x(i+1)-x(i),y(i+1)-y(i)
700 NEXT i
710 FOR e=2 TO a-1
720 PLOT c(e),d(e)
730 NEXT e
740 RETURN