Posted on September 12, 2013 @ 09:14:00 AM by Paul Meagher
Processing: A Programming Handbook
for Visual Designers and Artists
Casey Reas and Ben Fry (Foreword by John Maeda).
Published August 2007, MIT Press. 736 pages. Hardcover.
To give you a flavor of the language I'll offer up a couple of processing sketches from the book above. I was looking for some code that would get me started on drawing a tree and found this code (p. 202) for drawing a T.
The code above generates a simple tree structure that could be the starting point for a decision tree:
Cool! By making a few modifications to this program (e.g., adding recursive calls to the
drawT function) a fractal tree can be generated with the following code:
Here is the output that the sketch above generates:
This, of course, is not a full-bodied decision tree but it gives us some insight into how the skeleton of a simple binary decision tree might be created - by calling a
drawT function multiple times with the appropriate positional parameters. I'd prefer a left-to-right layout rather than a bottom-to-top layout so that connections can be labelled easier.