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

Sunday, 13 June 2010

Levy Carpet Fractal (using ypsilon Scheme context free library)

Here is another set of context free rules in scheme, note I've created a highlighting mode for the scheme DSL for jEdit (but I'm not releasing it yet/if ever) get the Scheme context free library here.

   1 ;Levy Carpet fractal
   2 ;By Martin Prout
   3 ;
   4 
   5 (import (psilab cfdg core)
   6         (psilab cfdg rule))
   7 
   8 (define ISQRT2 (/ (sqrt 2)))
   9 
  10 (rule tapestry
  11   (1 (levy)
  12      (levy (flip 90))
  13   )
  14 )
  15 
  16 (rule levy
  17    (1 (square (alpha -0.8))
  18       (levy       
  19       (rotate 45) 
  20       (scale ISQRT2)
  21       (hue 0)
  22       (saturation 0.1)
  23       (brightness 0.1)
  24       (alpha 0.6)
  25       (x 0.5) 
  26       )
  27       (levy       
  28       (rotate -45) 
  29       (scale ISQRT2)
  30       (hue 0)
  31       (saturation 0.1)
  32       (brightness 0.1)
  33       (alpha 0.6)
  34       (x 0.5) 
  35       )
  36    )
  37 )   
  38 
  39 (init-cfdg)
  40 
  41 (background (brightness -1)) 
  42 
  43 (bounds -1.2 1.2 -1.2 1.2)
  44 
  45 (start-shape tapestry) 


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