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

Saturday, 29 May 2010

Towards A Penrose Tiling Using context-free rules

Here is my penrosepp.cfdg script (which needs pre-processing see context free art forum to see how to do it) that creates some building blocks towards a penrose tiling.

   1 #define PHI ((sqrt(5) + 1)/2)
   2 #define IPHI (2/(sqrt(5) + 1))
   3 
   4 startshape tiling
   5 
   6 rule tiling{
   7   block{r 36}
   8   5 *{r 72}
   9   {sunstar{s IPHI x (1 + PHI)}}
  10 }  
  11 
  12 rule block{
  13 sunstar{s IPHI}
  14 5 *{r 72}
  15 {starsun{x PHI}}
  16 }
  17 
  18 rule starsun{
  19   sun{z -0.8}
  20   star{s IPHI z -0.7
  21   }
  22 }
  23 
  24 rule sunstar{
  25   star{z -1}
  26   sun{z -.9}
  27 }
  28 
  29 rule sun{
  30   5*{r 72}kite{}  
  31 }
  32 
  33 rule star{
  34   5*{r 72}dart{}  
  35 }
  36 
  37 rule kite {
  38   sharp{}
  39   sharp{flip 72}
  40 }
  41 
  42 rule dart {
  43   flat{}
  44   flat{flip 36}
  45 }
  46 
  47 path sharp {
  48   LINETO {x 1}
  49   LINETO {y sin(36) x cos(36)}
  50   CLOSEPOLY {}
  51   FILL {brightness 0.9 sat 1 hue 0}
  52   STROKE {width 0.01}
  53 }
  54 
  55 path flat {
  56   LINETO {x (cos(36) * PHI) y (sin(36) * PHI)}
  57   LINETO {x 1}
  58   CLOSEPOLY {}
  59   FILL {brightness 0.8 sat 1 hue 220}
  60   STROKE {width 0.01}
  61 }


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