-
-
Save jkwok91/b17369442359afd8850c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
jan 27, 2015 | |
*/ | |
void setup() { | |
size(243,243); | |
background(255); | |
} | |
void draw() { | |
stroke(0); | |
pushMatrix(); | |
translate(0, 2*height/3); | |
iterate(width, 5); // looks bad after this | |
popMatrix(); | |
} | |
void iterate(int len, int iteration) { | |
if (iteration == 1) { | |
line(0, 0, len, 0); | |
} else { | |
int oneThird = (int)(len/3); | |
int twoThirds = 2*oneThird; | |
PVector start_p = new PVector(oneThird, 0); | |
PVector start_2p = new PVector(oneThird, -1*oneThird); | |
PVector start_3p = new PVector(twoThirds, -1*oneThird); | |
PVector start_4p = new PVector(twoThirds, 0); | |
iterate(oneThird, iteration-1); | |
pushMatrix(); | |
translate(start_p.x, start_p.y); | |
rotate(-PI/2); | |
iterate(oneThird, iteration-1); | |
popMatrix(); | |
pushMatrix(); | |
translate(start_2p.x, start_2p.y); | |
iterate(oneThird, iteration-1); | |
popMatrix(); | |
pushMatrix(); | |
translate(start_3p.x, start_3p.y); | |
rotate(PI/2); | |
iterate(oneThird, iteration-1); | |
popMatrix(); | |
pushMatrix(); | |
translate(start_4p.x, start_4p.y); | |
iterate(oneThird, iteration-1); | |
popMatrix(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://i57.tinypic.com/2v989dc.jpg MUTHAFUCKA