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

Thursday, 17 June 2010

Yet Another Sierpinski (in context free Scheme)

Get the Scheme context free library here.

   1 ;A Sierpinski on Ypsilon Scheme
   2 ;By Martin Prout
   3 ;
   4 
   5 (import (psilab cfdg core)
   6         (psilab cfdg rule))
   7 
   8 
   9 (define Y_TOP (/ 1.0 (sqrt 3)))
  10 (define Y_BOT (/ (sqrt 3) -6))
  11 
  12 (rule unit
  13    ( 1 (triangle
  14       (hue 0)
  15       (brightness 0.2)
  16       (saturation 0.2)
  17   )
  18   (unit 
  19     (scale 0.5)
  20     (brightness 0.2)
  21     (saturation 0.2)
  22     (x 0.5)
  23     (y Y_BOT)
  24     )
  25 
  26   (unit
  27     (scale 0.5)
  28     (brightness 0.2)
  29     (saturation 0.2)
  30     (x -0.5)
  31     (y Y_BOT)
  32   )
  33   
  34   (unit 
  35     (scale 0.5)
  36     (brightness 0.2)
  37     (saturation 0.2)
  38     (x 0)
  39     (y Y_TOP)
  40     )
  41   )
  42 )
  43 
  44 (init-cfdg)
  45 
  46 (background (brightness -1)) 
  47 
  48 (bounds -0.5 0.5 -0.4 0.6)
  49 
  50 (start-shape unit) 
 
 

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