Pentagram: Difference between revisions

924 bytes added ,  9 years ago
→‎{{header|PostScript}}: +an off topic example
(→‎{{header|PostScript}}: +an off topic example)
Line 125:
s 170 t p s 2 setlinewidth stroke r g fill r % non-zero, but hide inner strokes
 
%%EOF</lang>
 
The following isn't exactly what the task asks for, but it's kind of fun if you have a PS interpreter that progressively updates. The program draws a lot of stars, so it's extremely likely that some of them are pentagrams...
<lang postscript>%!PS-Adobe-3.0 EPSF
%%BoundingBox: 0 0 400 400
 
% randomly choose from 5- to 35-stars
/maxpoint 35 def
/minpoint 5 def
/maxradius 30 def
 
/rnd1 { rand 16#80000000 div } def
/rnd { rnd1 mul} def
/rndi { 2 index sub rnd1 mul 1 index div cvi mul add} def
/line { rotate 0 rlineto } def
 
/star { gsave
/n minpoint 2 maxpoint rndi def
/r maxradius rnd def
/a 180 180 n div sub def
/b 360 a n mul sub n div def
 
400 rnd 400 rnd translate 360 rnd rotate
0 0 moveto n { r a line r b line } repeat closepath
rnd1 rnd1 rnd1 3 { 2 index 1 exch sub } repeat
gsave setrgbcolor fill grestore setrgbcolor stroke
grestore } def
 
0 setlinewidth 2000 {star} repeat showpage
%%EOF</lang>
 
Anonymous user