Recently I've been looking at Povray, pyprocessing, and cfdg (version 3.0) as tools for creating digital images. I have branched two separate blogs where I mainly explore jruby + processing and processing.py

Tuesday, 15 September 2009

Emergent Structure in Context Free

The following rules can produce quite weak output just a few hexagons, on the other hand more complex structure can emerge, it is just a question of chance (to avoid over long recursion I have included one empty rule so the recursion could terminate very quickly, however it could still take a long time for some shapes to render).
   1 startshape begin
   2   
   3 tile { s 10 (10*sqrt(3)) }
   4 background{b -1}
   5 
   6 rule begin {hextiles{ h 240 sat 1 b 1 } }
   7  rule hextiles 1{ 
   8  hexagon {} 
   9  }
  10 rule hextiles 10{ 
  11 hexagon {} 
  12 hextiles { y (sqrt(3)) z 1 h 1 } 
  13 }
  14 rule hextiles 1.5{ 
  15 hextiles {flip 60}
  16 hextiles {flip 180}
  17 }
  18 rule hextiles 0.5{}
  19 
  20 path hexagon{
  21 MOVETO{x .25 y (sqrt(3)/4)}
  22 LINETO{x .5 y 0}
  23 LINETO{x .25 y (-sqrt(3)/4)}
  24 LINETO{x -.25 y (-sqrt(3)/4)}
  25 LINETO{x -.5 y 0}
  26 LINETO{x -.25 y (sqrt(3)/4)}
  27 CLOSEPOLY{}
  28 STROKE{width 0.01 b -1}
  29 FILL{}
  30 } 
 
With the exception of the mainly pale green image, the other images rendered pretty quickly, as did those that produced a disappointing number of shapes (2, 4 etc). I prefer the outer two, where there are clearly emergent star, and larger pentagon structures emerging. Just for good measure here are four more images  generated with these rules.

No comments:

Post a Comment

Followers

Blog Archive

About Me

My photo
Pembrokeshire, United Kingdom
I have developed JRubyArt and propane new versions of ruby-processing for JRuby-9.1.5.0 and processing-3.2.2