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, 18 June 2009

Context Free 'theory' tutorial with a processing outcome

For those of us on the processing/context free journey (that's probably just me and lazydog) there is an interesting tutorial by Adam Parish, where he presents a grammar parser written in java, that spits out a licorice allsorts, from an 'improbable' English sentence "the dog lusts after the cat" from running "java ContextFree < test.grammar" (make sure you run it a few times) to a valid processing file from "java PDEGenerator", its a lot of fun I urge you to try it out.
One of the more interesting of the generated processing code was as follows:-
   1:size(512, 512);
2:background(255);
3:rectMode(CENTER);
4:translate(width/2,height/2);
5:fill(0, 0, 240, 32);
6:noStroke();
7:rect(0, 0, 500, 500);
8:pushMatrix();
9:translate(-125, 0);
10:scale(0.45);
11:rect(0, 0, 500, 500);
12:popMatrix();
13:pushMatrix();
14:translate(125, 0);
15:scale(0.45);
16:rect(0, 0, 500, 500);
17:pushMatrix();
18:translate(-125, 0);
19:scale(0.45);
20:rect(0, 0, 500, 500);
21:scale(0.75);
22:rect(0, 0, 500, 500);
23:scale(0.75);
24:ellipse(0, 0, 500, 500);
25:popMatrix();
26:pushMatrix();
27:translate(125, 0);
28:scale(0.45);
29:rect(0, 0, 500, 500);
30:scale(0.75);
31:ellipse(0, 0, 500, 500);
32:popMatrix();
33:popMatrix();


Output:-


PS: it seems as though "Dan Shiffman" also covers some relevant areas (l-systems) in one of his tutorials.

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