mathr / blog / #

PostScript experiments

PostScript experiments

Code:

%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 340 340

/START {
BRA x KET ROL
BRA x KET ROL
BRA x KET ROL
BRA x KET ROL
BRA x KET ROL
BRA x KET
} def

/x {
  dup 0 eq
  { END }
  { 1 sub
    a
    BRA b KET
    BRA ROL c KET
    BRA ROR c KET
    BRA ROL ROL d KET
    BRA ROR ROR d KET
    1 add
  }
  ifelse
} bind def

/a { 1 dup scale x } bind def
/b { 0.4 dup scale x } bind def
/c { 0.3 dup scale x } bind def
/d { 0.6 dup scale x } bind def

/BRA { currentpoint stroke moveto gsave } bind def
/KET { stroke grestore } bind def
/ROR { 60 neg rotate } bind def
/ROL { 60 rotate } bind def
/END { 1 0 rlineto } bind def

gsave
  newpath
  0 setgray
  0.001 setlinewidth
  1 setlinejoin
  1 setlinecap
  170 dup moveto
  100 dup scale
  15 rotate
  7 START
  stroke
grestore