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

Friday, 12 June 2009

Including other files in context free

There is some original work that exemplifies what it is to include another rule file in your art. The original work was gamma.cfdg calling gammabet.cfdg. Heres my calling code which calls a modified gammabet.cfdg.
What should strike you immediately is that these rules know nothing about the code called, its bit like this is the ribosome doing the processing and the called code is the messenger RNA, which is read out as protein (png or svg file). However to use the funky alphabet effectively, we really need to be able to sort out letter placing/spacing which to my "limited" knowledge has to be done manually. If my memory serves me correctly, something similar has been done in processing.js where the letter width is calculated on the fly. May'be this is where ruby-processing could come to the rescue, but hey I'm an utra NOOBIE with context free I might have got it wrong?

   1:startshape  GAMMA
2:include gammabet.cfdg // file to include
3:background {hue 30 sat 1 b -1}
5:rule CIR 3{CIR{hue -30}}
6:rule CIR 1{CIR{}CIR{s .8}}
7:rule CIR .2{CIR{s 1.5}}
8:rule CIR 1{CIRCLE{b 1 sat 1 hue -30}}
9:rule CIR .3{CIRCLE{}}

To give:

In the absence of tutorial/book to hand, I'm just hacking bits of code to learn the rules (which are subject to change at any event working towards version 3.0 (like python 3.0, not like the once mythical perl 6.0 you might hope)).
PS if you want a transparent backround it couldn't be easier replace the third line with

background {a -1}

could it be any more terse to specify no alpha?
This file also demonstrates the weight (or probability) parameter of a rule. Here we have group of rules with the same name, without any weighting factor there would be an equal probability that each version would be followed. But here the are different weights assigned to each of the CIR rules.
Why am I brought back to thinking about the Monty Hall paradox? I had great fun with that at the swimming pool last year no-one believed me at first, you know the one about the donkey and the three doors? That's when a good grounding in statistics puts you ahead of the other man, they'll believe any sort of rubbish, I saw through Gordon Brown years ago, god help us all now, he's trashed the value of our pension, and the kids have a mountain of debt to pay off.

No comments:

Post a Comment


Blog Archive

About Me

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