04.04.2013 Views

Processing: Creative Coding and Computational Art

Processing: Creative Coding and Computational Art

Processing: Creative Coding and Computational Art

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

}<br />

}<br />

// generates organic looking branches<br />

orgLine(pts[counter2].x, pts[counter2].y, ➥<br />

pts[counter2].x+xg+xx, pts[counter2].y-yg+yy);<br />

/* fill up pts array to be passed back<br />

recursively to branch function */<br />

pts[counter+1] = new Point2D.Float(pts[counter2].x+xg+xx, ➥<br />

pts[counter2].y-yg+yy);<br />

// alternate branches left <strong>and</strong> right<br />

xg*=-1;<br />

// keep track of nodes<br />

counter++;<br />

// keeps track of branches<br />

counter2++;<br />

//recursive call<br />

branch(pts);<br />

}<br />

// generates organic-looking branches<br />

void orgLine (float x1, float y1, float x2, float y2){<br />

int sections = 8;<br />

float xd = x2-x1;<br />

float yd = y2-y1;<br />

float twist;<br />

float[]twist2 = new float[sections+1];<br />

for (int i =0; i

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!