home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / f / fracxtr4.zip / PENROSE.L < prev    next >
Text File  |  1993-02-08  |  6KB  |  201 lines

  1.  
  2. KitesAndDarts { ; by Herb Savage
  3. ; based on Martin Gardner's "Penrose Tiles to Trapdoor Ciphers",
  4. ; Roger Penrose's kites and darts
  5.   Angle 10
  6.   Axiom WG+XG+WG+XG+WG+XG+WG+XG+WG+X
  7.   W=[F][++@1.618033989F][++G---@.618033989G|X-Y|G|W]
  8.   X=[F+++@1.618033989F][++@.618033989GZ|X|-G|W]
  9.   Y=[+F][@1.618033989F][+G@.618033989|Y+X]
  10.   Z=[-F][@1.618033989F][@.618033989G--WG|+Z]
  11.   F=
  12.   }
  13.  
  14. KitesAndDartsColor { ; by Herb Savage
  15. ; based on Martin Gardner's "Penrose Tiles to Trapdoor Ciphers",
  16. ; Roger Penrose's kites and darts
  17.   Angle 10
  18.   Axiom WG+XG+WG+XG+WG+XG+WG+XG+WG+X
  19.   W=[C10F][++@1.618033989C12F][++G---@.618033989G|X-Y|G|W]
  20.   X=[C10F+++@1.618033989C12F][++@.618033989GZ|X|-G|W]
  21.   Y=[+C10F][@1.618033989C12F][+G@.618033989|Y+X]
  22.   Z=[-C10F][@1.618033989C12F][@.618033989G--WG|+Z]
  23.   F=
  24.   }
  25.  
  26. Penrose1Forced { ; by Herb Savage
  27. ; based on Martin Gardner's "Penrose Tiles to Trapdoor Ciphers",
  28. ; Roger Penrose's rhombuses
  29. ; Uses color to show the edge matching rules to force nonperiodicy
  30.   Angle 10
  31.   Axiom +WC10FC12F--XC11FC10F---YC10FC11F--ZC12FC10F
  32.   W=YC10FC11F++ZC12FC10F----XC11FC10F[-YC10FC11F----WC10FC12F]++
  33.   X=+YC10FC11F--ZC12FC10F[---WC10FC12F--XC11FC10F]+
  34.   Y=-WC10FC12F++XC11FC10F[+++YC10FC11F++ZC12FC10F]-
  35.   Z=--YC10FC11F++++WC10FC12F[+ZC12FC10F++++XC11FC10F]--XC11FC10F
  36.   F=
  37.   C=
  38. }
  39.  
  40. { Generation of Penrose aperiodic tilings
  41.  
  42. Thanks to Herb Savage, who showed it was possible to generate those tilings
  43. with L-systems and Fractint.
  44.  
  45. Based on decomposition of tilings described in Tilings and Pattern, by
  46. Branko Grunbaum and G.C. Shepard, W.H. Freeman and Company, chapter 10
  47.  
  48. Philippe Hurbain
  49. 49 rue Jules Fossier
  50. 95380 LOUVRES
  51. FRANCE
  52. }
  53.  
  54. Losanges {
  55.            ;; by Philippe Hurbain
  56.            ;; Penrose's rhombuses, generated by decomposition rules
  57.            ;; x generate the fat rhombus, y the thin one
  58.            ;; Individualization of rhombuses allows easy coloring
  59.            ;; 0.618034 is (SQRT(5)-1)/2
  60.   Angle 10
  61.   Axiom x
  62.   x=@.618034+f[|y]--f[|x][|+@.618034g@i.618034x]---[x]f--[y]f
  63.   y=@.618034++[x]f|+f[|y]-[y]f|+f[|x]
  64.   f=g
  65. }
  66.  
  67. PentaColor {
  68.              ;; by Philippe Hurbain
  69.              ;; Simple coloring of Penrose's rhombuses, showing pentagons
  70.   Angle 20
  71.   Axiom c04[x]++++[x]++++[x]++++[x]++++[x]
  72.   x=@.618034++f[c10@1.1755-------f][|y]----f[|x]
  73.   x=[|++@.618034g@i.618034x]------[x]f----[y]f
  74.   y=@.618034++++[x]f|++f[|y]--[y]f|++f[|x]
  75.   f=g
  76. }
  77.  
  78. Penta {
  79.         ;; by Philippe Hurbain
  80.         ;; Same as PentaColor, but showing only the coloring
  81.   Angle 20
  82.   Axiom [x]++++[x]++++[x]++++[x]++++[x]
  83.   x=@.618034++g[@1.1755-------f][|y]----g[|x]
  84.   x=[|++@.618034g@i.618034x]------[x]g----[y]g
  85.   y=@.618034++++[x]g|++g[|y]--[y]g|++g[|x]
  86.   f=g
  87. }
  88.  
  89. Kites&Darts {
  90.               ;; by Philippe Hurbain
  91.               ;; Penrose's kites and darts
  92.               ;; k generates the kite, a generates the dart
  93.   Angle 10
  94.   Axiom k
  95.   k=+[@.618034a]f@.618034---[-k]f-f---[-k]@i.618034f[@.618034|a]
  96.   a=[@.618034k]+f@.618034[|a]----f+f----[a]@i.618034f
  97.   f=g
  98. }
  99.  
  100. Kites&Darts2 {
  101.                ;; by Philippe Hurbain
  102.                ;; Penrose's kites and darts, with kites seed
  103.   Angle 10
  104.   Axiom [k]++[k]++[k]++[k]++[k]
  105.   k=+[@.618034a]f@.618034---[-k]f-f---[-k]@i.618034f[@.618034|a]
  106.   a=[@.618034k]+f@.618034[|a]----f+f----[a]@i.618034f
  107.   f=g
  108. }
  109.  
  110. Kites&Darts3 {
  111.                ;; by Philippe Hurbain
  112.                ;; Penrose's kites and darts, with darts seed
  113.   Angle 10
  114.   Axiom [a]++[a]++[a]++[a]++[a]
  115.   k=+[@.618034a]f@.618034---[-k]f-f---[-k]@i.618034f[@.618034|a]
  116.   a=[@.618034k]+f@.618034[|a]----f+f----[a]@i.618034f
  117.   f=g
  118. }
  119.  
  120. Kites&DartsColor {
  121.                    ;; by Philippe Hurbain
  122.                    ;; Penrose's kites and darts, with serpentine coloring
  123.   Angle 10
  124.   Axiom c4[k]++[k]++[k]++[k]++[k]
  125.   k=+[@.618034a[g---@.618c10f][--g+++@.618c10f]]
  126.   k=f@.618034---[-k]f-f---[-k]@i.618034f[@.618034|a]
  127.   a=[@.618034k]+f@.618034[|a][|g++@.382c10f]----f+
  128.   a=f----[a][g--@.382c10f]@i.618034f
  129.   f=g
  130. }
  131.  
  132. AmmannPolyColor {
  133.                   ;; by Philippe Hurbain
  134.                   ;; Ammann's coloring of Penrose's rhombuses, giving an
  135.                   ;; aperiodic tiling of 2 pentagons and 1 hexagon
  136.   Angle 10
  137.   Axiom c1x
  138.   x=@.618034/36[c3\9@.66D]D[c3/196.5@.363D][/180y]\72D[/180x]
  139.   x=[\144@.618034M@i.618034x]\108[c3\36@.509D@1.18\30D][x]D[c3\153@.66D]\72[y]D
  140.   y=@.618034/72[x][c3\36@.509D]D\144[c3\9@.66D]D[/180y][c3/196.5@.363D]
  141.   y=\36[y]D\144D[/180x]
  142.   D=M
  143. }
  144.  
  145. AmmannPoly {
  146.              ;; by Philippe Hurbain
  147.              ;; Same as AmmanPolyColor, showing only the
  148.              ;; pentagon/hexagon tiling
  149.   Angle 10
  150.   Axiom x
  151.   x=@.618034/36[\9@.66D]M[/196.5@.363D][/180y]\72M[/180x]
  152.   x=[\144@.618034M@i.618034x]\108[\36@.509D@1.18\30D][x]M[\153@.66D]\72[y]M
  153.   y=@.618034/72[x][\36@.509D]M\144[\9@.66D]M[/180y][/196.5@.363D]
  154.   y=\36[y]M\144M[/180x]
  155.   D=M
  156. }
  157.  
  158. Stars&PentasColor {
  159.                 ;; by Philippe Hurbain
  160.                 ;; Penrose's stars and pentagon tiling, generated as
  161.                 ;; a coloring of kites and darts
  162.   Angle 20
  163.   Axiom c04k
  164.   k=++[@.618034[g-c10@.5878[f]------ff++++f]a]f@.618034------
  165.   k=[--k]f--f------[--k]@i.618034f[@.618034|a]
  166.   a=[@.618034k]++f@.618034[|[gc10@.5878+++++++f]a]--------f
  167.   a=++f--------[c10g@.5878-------f][a]@i.618034f
  168.   f=g
  169. }
  170.  
  171. Stars&Pentas1 {
  172.                 ;; by Philippe Hurbain
  173.                 ;; Same as Stars&PentasColor, showing only coloring
  174.   Angle 20
  175.   Axiom [k]++++[k]++++[k]++++[k]++++[k]
  176.   k=++[@.618034[g-@.5878[f]------ff++++f]a]g@.618034------
  177.   k=[--k]g--g------[--k]@i.618034g[@.618034|a]
  178.   a=[@.618034k]++g@.618034[|[g@.5878+++++++f]a]--------g
  179.   a=++g--------[g@.5878-------f][a]@i.618034g
  180.   f=g
  181. }
  182.  
  183. Stars&Pentas2  {
  184.                  ;; by Philippe Hurbain
  185.                  ;; Penrose's stars and pentagons, generated from
  186.                  ;; decomposition rules
  187.                  ;; u is the star, v is the boat, w is the thin rhombus
  188.                  ;; x, y and z are the pentagons
  189.   Angle 10
  190.   Axiom u
  191.   u=@.381966[v]F[|y][-u]++F|+[v]F[|y]++F|+[v]F[|y]++F|+
  192.   u=[v]F[|y]++F|+[v]F[|y]++F
  193.   v=@.381966[v]F[|y]++F|+[v]F[|y]-[u]F-F|+[v]F[|y]++F
  194.   w=@.381966G++[u]F|+F-F|+[v]F[|y]
  195.   y=@.381966[x][y][w]F[|!y]++F++[y][w]F[|!y]++F++[z]F
  196.   x=@.381966G++G++[!x][!z]F--[!z]F--[!z]F--[!z]F--[!z]F
  197.   z=@.381966[z][x]F++[z]F++[w][y]F[|!y]++F++[z]F
  198.   F=G
  199. }
  200.  
  201.