Sierpinski triangle: Difference between revisions
Content added Content deleted
(→{{header|PostScript}}: cleaner version) |
(→{{header|PostScript}}: cleaner implementation) |
||
Line 1,167: | Line 1,167: | ||
=={{header|PostScript}}== |
=={{header|PostScript}}== |
||
This draws the triangles in a string-rewrite fashion, where all edges form a single polyline. 9 page document showing progession. |
|||
<lang postscript>%!PS-Adobe-3.0 |
|||
<lang postscript>/F { 1 0 rlineto } def |
|||
%%BoundingBox 0 0 300 300 |
|||
⚫ | |||
/- {-120 rotate } def |
|||
⚫ | |||
/^ { 2 2 scale } def |
|||
/!0{ dup 1 sub dup -1 eq not } def |
|||
/ |
/X { !0 { v X + F - X - F + X ^ } { F } ifelse pop } def |
||
⚫ | |||
⚫ | |||
0 1 8 { 300 300 scale 0 1 12 div moveto |
|||
X + F + F fill showpage } for |
|||
⚫ | |||
{ .5 .5 scale f S S S } ifelse |
|||
grestore f r f pop |
|||
} def |
|||
300 300 scale 0 1 12 div translate |
|||
8 S pop |
|||
showpage |
|||
%%EOF |
|||
⚫ | |||
=={{header|Pop11}}== |
=={{header|Pop11}}== |