2 deleted 8 characters in body
source | link

Postscript 268

Postscript 156 - 25% = 117

/A{4 dict begin/ptranslate exch def/n1 exch def/m matrix currentmatrix defdup 
 dup scale/s matrix currentmatrix def 
0 360 n div 359.9({{//s setmatrix rotate //pcurrentlinewidth exec}for//mmul setmatrix})tokensetlinewidth
pop exch1 pop0 endmoveto exec}def
translatedup{360 1 index 0div moveto{rotate 1 0 lineto}Arepeat closepath stroke
  showpage

Pass the radius, number of sides, and center point on the command line

gs -c "100 9 300 200" -- polyg.ps

or prepend to the source

echo 100 9 300 200 | cat - polyg.ps | gs -

TheTranslate to the center, scale up to the radius, move to A procedure is probably overkill(1,0); then repeat n times: rotate by 360/n, draw line to (1,0); draw final line, stroke and emit the page.

Postscript 268

/A{4 dict begin/p exch def/n exch def/m matrix currentmatrix def 
 dup scale/s matrix currentmatrix def 
0 360 n div 359.9({{//s setmatrix rotate //p exec}for//m setmatrix})token
pop exch pop end exec}def
translate 1 index 0 moveto{1 0 lineto}A closepath stroke
 showpage

Pass the radius, number of sides, and center point on the command line

gs -c "100 9 300 200" -- polyg.ps

or prepend to the source

echo 100 9 300 200 | cat - polyg.ps | gs -

The A procedure is probably overkill.

Postscript 156 - 25% = 117

translate exch 1 exch dup dup scale div currentlinewidth mul setlinewidth
1 0 moveto dup{360 1 index div rotate 1 0 lineto}repeat closepath stroke showpage

Pass the radius, number of sides, and center point on the command line

gs -c "100 9 300 200" -- polyg.ps

or prepend to the source

echo 100 9 300 200 | cat - polyg.ps | gs -

Translate to the center, scale up to the radius, move to (1,0); then repeat n times: rotate by 360/n, draw line to (1,0); draw final line, stroke and emit the page.

1
source | link

Postscript 268

/A{4 dict begin/p exch def/n exch def/m matrix currentmatrix def 
dup scale/s matrix currentmatrix def 
0 360 n div 359.9({{//s setmatrix rotate //p exec}for//m setmatrix})token
pop exch pop end exec}def
translate 1 index 0 moveto{1 0 lineto}A closepath stroke
showpage

Pass the radius, number of sides, and center point on the command line

gs -c "100 9 300 200" -- polyg.ps

or prepend to the source

echo 100 9 300 200 | cat - polyg.ps | gs -

The A procedure is probably overkill.