## Samstag, 26. Januar 2013

### Fractal Chaos

I have always loved fractal, recursive, patterns. I recently was curios to find out what a rhombus would look like, if you inscribed a rhombus (inscribed with a rhombus(inscribed with a rhombus(inscribed with a rhombus(etc.)))) on each of its sides. I implemented this in processing, using 60° angles and letting the size of each iteration be one third of the original. I was both surprised and disappointed at how regular the pattern was which emerged.

Ways of making the pattern more interesting was to asymmetrically allow some rhombi to be double the size of others.

Allowing all the rhombi to be two thirds the size of what I originally planned also yielded a pattern I quite liked:

Especially, if I increased the number of recursive iterations significantly:

Changing the size of the rhombi to random values resulted in an odd cloudy shape:

I liked this effect, so I tried to emphasize it, by using thicker lines and transparency

I also used this to make a simple animation to a song of mine I put on youtube. Nothing flashy, I was just playing around and liked the result so I uploaded it:

For those interested, here is the code. If anyone else comes up with some fun fractals, feel free to link to them in the comments section:

//fractal pattern by Paul Strohmeier
//based on one of the processing examples
//paul.strohmeierATgmailDOTcom
//fkeel.blogspot.com

int counter = 0;

void setup() {
size(1900, 1900);
translate(width/2,0);
background(0);
stroke(20,100,190);
rhombus(250);
}

void draw() {
save("fractal4.jpg");
}

void rhombus(float third) {

if (third > 1) {

pushMatrix();    // Save the current state of transformation (i.e. where are we now)

rotate(radians(60));  // Rotate by theta
line( 0, 0, third, 0);  // Draw the branch
line(2*third, 0, 3*third, 0);  // Draw the branch
pushMatrix();
translate(third, 0); // Move to the end of the branch
rotate(radians(-60));  // Rotate by theta
translate(third,0); // Move to the end of the branch
rotate(radians(60));  // Rotate by theta
rhombus(third/3);       // Ok, now call myself to draw two new branches!!
popMatrix();

rotate(radians(60));  // Rotate by theta
line( 0, 0, third, 0);  // Draw the branch
line(2*third, 0, 3*third, 0);  // Draw the branch

translate(third, 0); // Move to the end of the branch
rotate(radians(60));  // Rotate by theta
translate(third,0); // Move to the end of the branch
rotate(radians(120));  // Rotate by theta
rhombus(third/3);       // Ok, now call myself to draw two new branches!!
popMatrix();

pushMatrix();    // Save the current state of transformation (i.e. where are we now)
translate(3*third,0);
translate(3*third,0);

rotate(radians(60));  // Rotate by theta
line( 0, 0, third, 0);  // Draw the branch
line(2*third, 0, 3*third, 0);  // Draw the branch
pushMatrix();
translate(third, 0); // Move to the end of the branch
rotate(radians(-60));  // Rotate by theta
translate(third,0); // Move to the end of the branch
rotate(radians(60));  // Rotate by theta
rhombus(third/3);       // Ok, now call myself to draw two new branches!!
popMatrix();

rotate(radians(60));  // Rotate by theta
line( 0, 0, third, 0);  // Draw the branch
line(2*third, 0, 3*third, 0);  // Draw the branch

translate(third, 0); // Move to the end of the branch
rotate(radians(60));  // Rotate by theta
translate(third,0); // Move to the end of the branch
rotate(radians(120));  // Rotate by theta
rhombus(third/3);       // Ok, now call myself to draw two new branches!!
popMatrix();

}

}