home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1994 June / NEBULA_SE.ISO / SourceCode / Cookbook / 12.fractTree / tree.psw < prev    next >
Encoding:
Text File  |  1993-01-19  |  655 b   |  28 lines

  1. defineps doTree(float maxdepth, leftBranch, rightBranch, branchLength, moveRight, scaleX, scaleY, lineWidth, branchChange, widthChange)
  2.  
  3. %! From pg 74 of the "Blue Book"
  4.  
  5. /depth 0 def
  6. /down {/depth depth 1 add def} def
  7. /up   {/depth depth 1 sub def} def
  8. /doLine % Vertical line
  9. {0 branchLength rlineto currentpoint stroke translate 0 0 moveto}
  10. def
  11. /fractArrow 
  12. {gsave branchChange widthChange scale lineWidth setlinewidth
  13.  down doLine
  14.  depth maxdepth le 
  15.   {leftBranch neg rotate fractArrow rightBranch neg rotate fractArrow}
  16.  if
  17.  up grestore}
  18. def
  19.  
  20.  
  21. % "Main" program
  22. moveRight 0 moveto scaleX scaleY scale fractArrow 0.5 setgray stroke
  23. showpage 
  24.  
  25. endps
  26.  
  27.  
  28.