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

Friday, 12 June 2009

Rotating in context free

Just starting to experiment with context free rules interesting to to see what adding a bit of rotation does:-

 1 startshape sun
 2
 3 rule sun {
 4         5 * { r (360/5) } ray { h 0 b 1 sat 1 |h 60 }
 5 }
 6
 7 rule ray {
 8         CIRCLE { }
 9         ray { y .1 r 1 s .965 h .05| }
10 }
11
12 rule ray 0.15 {
13         ray { flip 90 }
14 }

Here is the result:

for the benefit of lazydog:

startshape sun

background{b -1}

rule sun {
10 * { r (360/5) } ray { h 0 b 1 sat 1 |h 60 }
}

rule ray {
CIRCLE { }
ray { y .1 r 1 s .965 h .05| }
}

rule ray 0.15 {
ray { rotate 90 }
}

6 comments:

  1. Looks great but I can't get it to run - I get a syntax error on 10 * { r (360/5) } ray { h 0 b sat 1 h 60 }. Having line numbers in means it's not a simple cut & paste!

    b e n

    ReplyDelete
  2. I should warn I am using version-2.2-beta2, because someone kidly posted an ebuild (for gentoo) that uses existing libraries, hence incredibly small footprint. By the way I get different results every time I run the program with these rules, can't say I understand how it all works yet....

    ReplyDelete
  3. Silly me I think one of the r's is for random (couldn't get much more dense syntax)

    ReplyDelete
  4. I've been struggling to get a decent color scheme for syntax highlighting from console vim with a white background. The missing pipes do show up if you highlight the text. (Emacs has highlighting for context free but the htmlize function is broken). Running cfdg in a console is pretty convenient on linux as I can use 'feh' to view the png file. By the way check out Whorld.cfdg for a mega rule.

    ReplyDelete
  5. Works now thanks!

    Can't help thinking the end results look a bit like half a dozen people entangled in an orgy.

    b e n

    ReplyDelete

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