/**
* "recursive area tiling algorithmen"
* Press mouse bottom left to init again
* Feel free to use / modify this code however you wish.
* We would be happy if you would make a reference to
* www.looksgood.de and to generative-systeme.de
*
* Benedikt Groß & Julia Laub
* benedikt ät looksgood dot de / julia ät generative-systeme dot de
*/
void setup()
{
size(400, 400);
smooth();
background(255);
divide(0,0,256,362, 15);
}
void draw() {
}
void mousePressed() {
background(255);
divide(0,0,256,362, 15);
}
void divide(float x1, float y1, float x2, float y2, int depth)
{
//do recurson untill
if (depth<1)
return;
int horOrVert = round(random(10));//tiling vertical or horicontal
int count = (int)random(1,3);//each tile divide in n parts
depth -= 1;//increment
//tiling vertical or horicontal
if (horOrVert < 4) {
float x_width = abs(x2-x1)/count;
if (x_width < 1.8) count = 1;
for (int i=0; i