Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.81 KB | None | 0 0
  1. %!Postscript File
  2. %
  3. % % ------------------------------------------------------
  4. % % These are unit definitions. They define conversion factors for
  5. % % common units like mils, inches, millimeters, etc.
  6. % % ------------------------------------------------------
  7. /mil { 0.072 mul } def
  8. /in { 72 mul } def
  9. /mm { 2.83464567 mul } def
  10. %
  11. % ------------------------------------------------------
  12. % The Golden Ratio
  13. % ------------------------------------------------------
  14. /phi 1.618034 def
  15.  
  16. % ------------------------------------------------------
  17. % 19mm tile width fits fairly well into an A4 sheet
  18. % and is a good size for fridge magnets. (20mm is just
  19. % a smidgin too big for A4)
  20. % ------------------------------------------------------
  21. /tilesize 19 mm def
  22.  
  23. % ------------------------------------------------------
  24. % According to the theory of Penrose tiling, the
  25. % thick:thin tile ratio should be approximately 16:10
  26. % so here we have 99:63, making each sheet good for
  27. % making patterns with only a few tiles left over.
  28. % ------------------------------------------------------
  29. /thinrows 7 def
  30. /thincols 9 def
  31. /thickrows 11 def
  32. /thickcols 9 def
  33.  
  34. % ------------------------------------------------------
  35. % This probably should be left as zero.
  36. % ------------------------------------------------------
  37. /tilegap 0 mm def
  38.  
  39. % ------------------------------------------------------
  40. % If you increase this size you'll have to change the
  41. % radius of the arcs or they'll collide on the thin
  42. % tiles.
  43. % ------------------------------------------------------
  44. /linewidth 1 mm def
  45.  
  46. % ------------------------------------------------------
  47. % Arc colours in RGB format
  48. % ------------------------------------------------------
  49. /colour1 {1 0 0} def % small radius
  50. /colour2 {0 0 1} def % large radius
  51. /colour3 {0 0 0} def % bisectors (not currently used
  52. % because they collide with the
  53. % arcs on the thin tile))
  54.  
  55. %/colour2 {1 0.843 0} def % gold
  56. %/colour1 {0.753 0.753 0.753} def % silver
  57.  
  58.  
  59. % ------------------------------------------------------
  60. % ------------------------------------------------------
  61. % Little below here should need changing
  62. % ------------------------------------------------------
  63.  
  64. % ------------------------------------------------------
  65. % draw a tile (args: <rotation> <x origin> <y origin>)
  66. % ------------------------------------------------------
  67. /tile {
  68. gsave
  69. translate
  70. 0 mm setlinewidth
  71. newpath
  72. 0 0 moveto
  73. tilesize 0 rlineto
  74. dup neg rotate
  75. %-54 rotate
  76. 0 tilesize rlineto
  77. rotate
  78. %54 rotate
  79. tilesize neg 0 rlineto
  80. closepath
  81. stroke
  82. grestore
  83.  
  84. } def
  85.  
  86. % ------------------------------------------------------
  87. % draw alignment arcs for thick tiles
  88. % (args: <x origin> <y origin>)
  89. % ------------------------------------------------------
  90. /thickarcs {
  91. gsave
  92. translate
  93. 36 rotate
  94.  
  95. % arc 1
  96. linewidth setlinewidth
  97. colour1 setrgbcolor
  98. newpath
  99. 0 0
  100. tilesize 5 phi div div
  101. -36 36 arc
  102. stroke
  103.  
  104. % outlines
  105. 0 mm setlinewidth
  106. colour3 setrgbcolor
  107. newpath
  108. 0 0
  109. tilesize 5 phi div div linewidth 2 div add
  110. -36 36 arc
  111. stroke
  112. newpath
  113. 0 0
  114. tilesize 5 phi div div linewidth 2 div sub
  115. -36 36 arc
  116. stroke
  117.  
  118. % arc 2
  119. linewidth setlinewidth
  120. colour2 setrgbcolor
  121. newpath
  122. tilesize phi div tilesize add 0
  123. tilesize 0.75 mul
  124. 144 216 arc
  125. stroke
  126.  
  127. 0 mm setlinewidth
  128. colour3 setrgbcolor
  129. newpath
  130. tilesize phi div tilesize add 0
  131. tilesize 0.75 mul linewidth 2 div add
  132. 144 216 arc
  133. stroke
  134.  
  135. % outlines
  136. newpath
  137. tilesize phi div tilesize add 0
  138. tilesize 0.75 mul linewidth 2 div sub
  139. 144 216 arc
  140. stroke
  141.  
  142. -36 rotate
  143. grestore
  144.  
  145. } def
  146. %
  147. % ------------------------------------------------------
  148. % draw alignment arcs for tin tiles
  149. % (args: <x origin> <y origin>)
  150. % ------------------------------------------------------
  151. /thinarcs {
  152. gsave
  153. translate
  154. 18 rotate
  155.  
  156. %newpath
  157. %0 0 moveto
  158. %0 10 lineto
  159. %stroke
  160.  
  161. % ------------------------------------------------
  162. % arc 1
  163. linewidth setlinewidth
  164. colour1 setrgbcolor
  165. newpath
  166. 0 0
  167. tilesize 5 phi div div
  168. 18 162 arc
  169. stroke
  170.  
  171. % outlines
  172. colour3 setrgbcolor
  173. 0 mm setlinewidth
  174. newpath
  175. 0 0
  176. tilesize 5 phi div div linewidth 2 div sub
  177. 18 162 arc
  178. stroke
  179. newpath
  180. 0 0
  181. tilesize 5 phi div div linewidth 2 div add
  182. 18 162 arc
  183. stroke
  184.  
  185. % ------------------------------------------------
  186. % arc 2
  187. linewidth setlinewidth
  188. colour2 setrgbcolor
  189. newpath
  190. %tilesize 108 sin mul 0
  191. 0 tilesize phi div
  192. tilesize 4 div
  193. 198 -18 arc
  194. stroke
  195.  
  196. % outlines
  197. colour3 setrgbcolor
  198. 0 mm setlinewidth
  199. newpath
  200. 0 tilesize phi div
  201. tilesize 4 div linewidth 2 div sub
  202. 198 -18 arc
  203. stroke
  204. newpath
  205. 0 tilesize phi div
  206. tilesize 4 div linewidth 2 div add
  207. 198 -18 arc
  208. stroke
  209.  
  210. % ------------------------------------------------
  211. -18 rotate
  212. grestore
  213.  
  214. } def
  215.  
  216. % ------------------------------------------------------
  217. % % draw Robinson bisectors
  218. % % ------------------------------------------------------
  219. /bisector {
  220. gsave
  221. translate
  222. linewidth 2 div setlinewidth
  223. colour3 setrgbcolor
  224. tilesize 0 moveto
  225. 36 rotate
  226. tilesize 0 rmoveto
  227. -36 rotate
  228. 0 0 lineto
  229. stroke
  230. grestore
  231. } def
  232.  
  233. % ------------------------------------------------------
  234. % draw tiles centred on A4 sheet
  235. % ------------------------------------------------------
  236. 210 mm tilesize 36 cos mul tilesize thincols mul add sub 2 div
  237. 297 mm tilesize 72 sin mul thickrows mul tilesize 36 sin mul thinrows mul add sub 2 div
  238. translate
  239.  
  240. % ------------------------------------------------------
  241. % draw thin tiles
  242. % ------------------------------------------------------
  243. 0 1 thincols 1 sub {
  244. /xp exch tilesize tilegap add mul def
  245. 0 1 thinrows 1 sub {
  246. /yp exch tilesize 36 sin mul tilegap add mul def
  247. 18 xp tilesize add yp thinarcs
  248. 54 xp yp tile
  249. %xp yp bisector
  250. } for
  251. } for
  252. % ------------------------------------------------------
  253. % draw thick tiles
  254. % ------------------------------------------------------
  255. 0 thinrows tilesize 36 sin mul tilegap add thinrows mul translate
  256. 0 1 thickcols 1 sub {
  257. /xp exch tilesize tilegap add mul def
  258. 0 1 thickrows 1 sub {
  259. /yp exch tilesize 72 sin mul tilegap add mul def
  260. xp yp thickarcs
  261. 18 xp yp tile
  262. %xp yp bisector
  263. } for
  264. } for
  265.  
  266. % ------------------------------------------------------
  267. % annotation
  268. % ------------------------------------------------------
  269. /Times-Roman findfont
  270. 12 scalefont
  271. setfont
  272. thincols tilesize 72 sin mul tilegap add mul tilesize 1.2 mul add tilesize 2 div moveto
  273. 90 rotate
  274. (Penrose P3 Tiles for the fridge. Print these on A4 magnetic sheet and cut them along the thin lines.) show
  275. 0 0 rmoveto
  276. /Times-Roman findfont
  277. 6 scalefont
  278. setfont
  279. ( [ChrisG 2017]) show
  280.  
  281. showpage
  282.  
  283. % that's all
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement