
PROG

(PARI)
ldraw(w, vx, vy, np, with, ia, ib, jb, ja) = {if (with, kdeb = 0; kend = np, kdeb = 1; kend = np1; ); for (k=kdeb, kend, plotmove(w, vx[ia]+k*(vx[ib]vx[ia])/np, vy[ia]+k*(vy[ib]vy[ia])/np); plotlines(w, vx[ja]+k*(vx[jb]vx[ja])/np, vy[ja]+k*(vy[jb]vy[ja])/np); ); }
modnv(i, nv) = {i = i % nv; if (i == 0, i = nv); return (i); }
poly(nv, np, with) = {w = 2; s = plothsizes(); plotinit(w, s[1]1, s[2]1); plotscale(w, 0, 1000, 0, 1000); xc = 500; yc = 500; vx = vector(nv, i, xc + 500*sin(i*2*Pi/nv)); vy = vector(nv, i, yc + 500*cos(i*2*Pi/nv)); plotlines(w , vx, vy, 1); plotmove(w, vx[nv], vy[nv]); plotlines(w, vx[1], vy[1]); np++; for (ia=1, nv, ia = modnv(ia, nv); ib = modnv(ia+1, nv); for (ja=1, nv, ja = modnv(ja, nv); if (ja != ia, jb = modnv(ja+1, nv); ldraw(w, vx, vy, np, with, ia, ib, ja, jb); ); ); ); plotdraw([w, 0, 0]); return(0); } \\ use poly(5, n, 0) to get figure with n points \\ Michel Marcus, Jul 09 2013
