Advertisement
OPiMedia

Koch snowflake in PostScript

Jan 24th, 2021
3,334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. %!PS-Adobe-3.0 EPSF-3.0
  2. %%BoundingBox: 0 0 110 120
  3. %%EndComments
  4. % Koch snowflake in PostScript
  5. % (c) Olivier Pirson --- http://www.opimedia.be/
  6. /left {% angle
  7.     rotate
  8. } def
  9.  
  10. /right {% angle
  11.     neg rotate
  12. } def
  13.  
  14.  
  15. /flock_side {% len, ite
  16.     /ite exch def
  17.  
  18.     ite 0 gt {
  19.         /len exch 3 div def
  20.         /ite ite 1 sub def
  21.  
  22.         len ite
  23.         len ite
  24.         len ite
  25.         len ite flock_side
  26.         60 left
  27.         flock_side
  28.         120 right
  29.         flock_side
  30.         60 left
  31.         flock_side
  32.     } {
  33.         0 rlineto
  34.     } ifelse
  35. } def
  36.  
  37.  
  38. .1 setlinewidth
  39. 5 89 moveto
  40.  
  41. 100 7
  42. /ite exch def
  43. /len exch def
  44.  
  45. len ite
  46. len ite
  47.  
  48. len ite flock_side
  49.  
  50. 120 right
  51. flock_side
  52.  
  53. 120 right
  54. flock_side
  55.  
  56. stroke
  57. %%EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement