//reproduction of 13-9-65
//creates a boolean variable to keep track of when the mouse has been clicked. program creates new iteration with every click
boolean click = true;
//creates random number (between 4 and 6) of circles. just a guess based on the original artwork
float numCircle = random(4,6);
//variables used for creating arrays
int numLines = 9;
int numVertex = 8;
int testWidth = 500;
int testHeight = 500;
//x value arrays
float[]x1 = new float[numVertex];
float[]x2 = new float[numVertex];
float[]x3 = new float[numVertex];
float[]x4 = new float[numVertex];
float[]x5 = new float[numVertex];
float[]x6 = new float[numVertex];
float[]x7 = new float[numVertex];
float[]x8 = new float[numVertex];
float[]x9 = new float[numVertex];
//y value arrays
float[]y1 = new float[numVertex];
float[]y2 = new float[numVertex];
float[]y3 = new float[numVertex];
float[]y4 = new float[numVertex];
float[]y5 = new float[numVertex];
float[]y6 = new float[numVertex];
float[]y7 = new float[numVertex];
float[]y8 = new float[numVertex];
float[]y9 = new float[numVertex];
float[]slope1 = new float[numVertex-1];
float[]slope2 = new float[numVertex-1];
float[]slope3 = new float[numVertex-1];
float[]slope4 = new float[numVertex-1];
float[]slope5 = new float[numVertex-1];
float[]slope6 = new float[numVertex-1];
float[]slope7 = new float[numVertex-1];
float[]slope8 = new float[numVertex-1];
float[]slope9 = new float[numVertex-1];
float[]xintercept1 = new float[numVertex];
//setup
void setup()
{
size(testWidth, testHeight);
background(255);
smooth();
noFill();
stroke(0);
}
//function to change the state of "click" variable
void mouseClicked()
{
click = true;
}
//begin drawing
void draw()
{
if(click)
{
background(255);
// create border
line(0,0,testWidth-1,0);
line(0,0,0,testHeight-1);
line(testWidth-1,testHeight-1,0,testHeight-1);
line(testWidth-1,testHeight-1,testWidth-1,0);
//create x value of vertices
for(int i = 0; i < numVertex; i++)
{
x1[i] = (testWidth/numVertex)*i + random(testWidth/numLines, (testWidth/numVertex)*0.25*i);
x2[i] = (testWidth/numVertex)*i + random(testWidth/numLines, (testWidth/numVertex)*0.25*i);
x3[i] = (testWidth/numVertex)*i + random(testWidth/numLines, (testWidth/numVertex)*0.25*i);
x4[i] = (testWidth/numVertex)*i + random(testWidth/numLines, (testWidth/numVertex)*0.25*i);
x5[i] = (testWidth/numVertex)*i + random(testWidth/numLines, (testWidth/numVertex)*0.25*i);
x6[i] = (testWidth/numVertex)*i + random(testWidth/numLines, (testWidth/numVertex)*0.25*i);
x7[i] = (testWidth/numVertex)*i + random(testWidth/numLines, (testWidth/numVertex)*0.25*i);
x8[i] = (testWidth/numVertex)*i + random(testWidth/numLines, (testWidth/numVertex)*0.25*i);
x9[i] = (testWidth/numVertex)*i + random(testWidth/numLines, (testWidth/numVertex)*0.25*i);
}
//set first x coordinate to 0 for all lines
x1[0] = 0;
x2[0] = 0;
x3[0] = 0;
x4[0] = 0;
x5[0] = 0;
x6[0] = 0;
x7[0] = 0;
x8[0] = 0;
x9[0] = 0;
//set last x coordinate to the testWidth
x1[numVertex-1] = testWidth;
x2[numVertex-1] = testWidth;
x3[numVertex-1] = testWidth;
x4[numVertex-1] = testWidth;
x5[numVertex-1] = testWidth;
x6[numVertex-1] = testWidth;
x7[numVertex-1] = testWidth;
x8[numVertex-1] = testWidth;
x9[numVertex-1] = testWidth;
//create y value of vertices
for(int i = 0; i < numVertex; i++)
{
y1[i] = random(0, (testHeight/numLines));
y2[i] = random(testHeight/numLines, (testHeight/numLines)*2);
y3[i] = random((testHeight/numLines)*2, (testHeight/numLines)*3);
y4[i] = random((testHeight/numLines)*3, (testHeight/numLines)*4);
y5[i] = random((testHeight/numLines)*4, (testHeight/numLines)*5);
y6[i] = random((testHeight/numLines)*5, (testHeight/numLines)*6);
y7[i] = random((testHeight/numLines)*6, (testHeight/numLines)*7);
y8[i] = random((testHeight/numLines)*7, (testHeight/numLines)*8);
y9[i] = random((testHeight/numLines)*8, (testHeight/numLines)*9);
}
//find slopes
for(int i = 0; i< numVertex-1; i++)
{
slope1[i] = (y1[i]- y1[i+1])/(x1[i]-x1[i+1]);
slope2[i] = (y2[i]- y2[i+1])/(x2[i]-x2[i+1]);
slope3[i] = (y3[i]- y3[i+1])/(x3[i]-x3[i+1]);
slope4[i] = (y4[i]- y4[i+1])/(x4[i]-x4[i+1]);
slope5[i] = (y5[i]- y5[i+1])/(x5[i]-x5[i+1]);
slope6[i] = (y6[i]- y6[i+1])/(x6[i]-x6[i+1]);
slope7[i] = (y7[i]- y7[i+1])/(x7[i]-x7[i+1]);
slope8[i] = (y8[i]- y8[i+1])/(x8[i]-x8[i+1]);
slope9[i] = (y9[i]- y9[i+1])/(x9[i]-x9[i+1]);
}
// draw horizontal lines from coordinates in arrays
for(int i = 0; i< numVertex-1; i++)
{
line(x1[i],y1[i], x1[i+1],y1[i+1]);
line(x2[i],y2[i], x2[i+1],y2[i+1]);
line(x3[i],y3[i], x3[i+1],y3[i+1]);
line(x4[i],y4[i], x4[i+1],y4[i+1]);
line(x5[i],y5[i], x5[i+1],y5[i+1]);
line(x6[i],y6[i], x6[i+1],y6[i+1]);
line(x7[i],y7[i], x7[i+1],y7[i+1]);
line(x8[i],y8[i], x8[i+1],y8[i+1]);
line(x9[i],y9[i], x9[i+1],y9[i+1]);
}
//draw vertical straight lines
for(int i = 0; i< numVertex-1; i++)
{
int chance = int(random(1,8));
int a = int(random(1,40));
int b = int(random(1,40));
int c = int(random(1,40));
int d = int(random(1,40));
if(chance == 1)
{
triangle(x1[i], y1[i], x1[i+1], y1[i+1], x2[i], y2[i]);
triangle(x1[i], y1[i], x2[i+1], y2[i+1], x2[i], y2[i]);
triangle(x1[i]+a, y1[i]+a*slope1[i], x1[i]+b, y2[i]+b*slope2[i], x2[i], y2[i]);
triangle(x1[i]+c, y1[i]+c*slope1[i], x1[i]+d, y2[i]+d*slope2[i], x2[i+1], y2[i+1]);
triangle(x1[i+1], y1[i+1], x1[i]+c, y1[i]+c*slope1[i], x2[i+1], y2[i+1]);
}
else if(chance ==3)
{
line(x1[i] + a, y1[i]+a*slope1[i], x1[i] + a, (y2[i])+a*slope2[i]);
line(x1[i] + b, y1[i]+b*slope1[i], x1[i] + b, (y2[i])+b*slope2[i]);
line(x1[i] + c, y1[i]+c*slope1[i], x1[i] + c, (y2[i])+c*slope2[i]);
line(x1[i] + d, y1[i]+d*slope1[i], x1[i] + d, (y2[i])+d*slope2[i]);
}
}
//fill 2
for(int i = 0; i< numVertex-1; i++)
{
int chance = int(random(1,8));
int a = int(random(1,40));
int b = int(random(1,40));
int c = int(random(1,40));
int d = int(random(1,40));
if(chance == 1)
{
triangle(x2[i], y2[i], x2[i+1], y2[i+1], x3[i], y3[i]);
triangle(x2[i], y2[i], x3[i+1], y3[i+1], x3[i], y3[i]);
triangle(x2[i]+a, y2[i]+a*slope2[i], x2[i]+b, y3[i]+b*slope3[i], x3[i], y3[i]);
triangle(x2[i]+c, y2[i]+c*slope2[i], x2[i]+d, y3[i]+d*slope3[i], x3[i+1], y3[i+1]);
triangle(x2[i+1], y2[i+1], x2[i]+c, y2[i]+c*slope2[i], x3[i+1], y3[i+1]);
}
else if(chance ==3)
{
line(x2[i] + a, y2[i]+a*slope2[i], x2[i] + a, (y3[i])+a*slope3[i]);
line(x2[i] + b, y2[i]+b*slope2[i], x2[i] + b, (y3[i])+b*slope3[i]);
line(x2[i] + c, y2[i]+c*slope2[i], x2[i] + c, (y3[i])+c*slope3[i]);
line(x2[i] + d, y2[i]+d*slope2[i], x2[i] + d, (y3[i])+d*slope3[i]);
}
}
//fill 3
for(int i = 0; i< numVertex-1; i++)
{
int chance = int(random(1,6));
int a = int(random(1,40));
int b = int(random(1,40));
int c = int(random(1,40));
int d = int(random(1,40));
if(chance == 1)
{
triangle(x3[i], y3[i], x3[i+1], y3[i+1], x4[i], y4[i]);
triangle(x3[i], y3[i], x4[i+1], y4[i+1], x4[i], y4[i]);
triangle(x3[i]+a, y3[i]+a*slope3[i], x3[i]+b, y4[i]+b*slope4[i], x4[i], y4[i]);
triangle(x3[i]+c, y3[i]+c*slope3[i], x3[i]+d, y4[i]+d*slope4[i], x4[i+1], y4[i+1]);
triangle(x3[i+1], y3[i+1], x3[i]+c, y3[i]+c*slope3[i], x4[i+1], y4[i+1]);
}
else if(chance ==3)
{
line(x3[i] + a, y3[i]+a*slope3[i], x3[i] + a, (y4[i])+a*slope4[i]);
line(x3[i] + b, y3[i]+b*slope3[i], x3[i] + b, (y4[i])+b*slope4[i]);
line(x3[i] + c, y3[i]+c*slope3[i], x3[i] + c, (y4[i])+c*slope4[i]);
line(x3[i] + d, y3[i]+d*slope3[i], x3[i] + d, (y4[i])+d*slope4[i]);
}
}
//fill 4
for(int i = 0; i< numVertex-1; i++)
{
int chance = int(random(1,6));
int a = int(random(1,40));
int b = int(random(1,40));
int c = int(random(1,40));
int d = int(random(1,40));
if(chance == 1)
{
triangle(x4[i], y4[i], x4[i+1], y4[i+1], x5[i], y5[i]);
triangle(x4[i], y4[i], x5[i+1], y5[i+1], x5[i], y5[i]);
triangle(x4[i]+a, y4[i]+a*slope4[i], x4[i]+b, y5[i]+b*slope5[i], x5[i], y5[i]);
triangle(x4[i]+c, y4[i]+c*slope4[i], x4[i]+d, y5[i]+d*slope5[i], x5[i+1], y5[i+1]);
triangle(x4[i+1], y4[i+1], x4[i]+c, y4[i]+c*slope4[i], x5[i+1], y5[i+1]);
}
else if(chance ==3)
{
line(x4[i] + a, y4[i]+a*slope4[i], x4[i] + a, (y5[i])+a*slope5[i]);
line(x4[i] + b, y4[i]+b*slope4[i], x4[i] + b, (y5[i])+b*slope5[i]);
line(x4[i] + c, y4[i]+c*slope4[i], x4[i] + c, (y5[i])+c*slope5[i]);
line(x4[i] + d, y4[i]+d*slope4[i], x4[i] + d, (y5[i])+d*slope5[i]);
}
}
//fill 5
for(int i = 0; i< numVertex-1; i++)
{
int chance = int(random(1,6));
int a = int(random(1,40));
int b = int(random(1,40));
int c = int(random(1,40));
int d = int(random(1,40));
if(chance == 1)
{
triangle(x5[i], y5[i], x5[i+1], y5[i+1], x6[i], y6[i]);
triangle(x5[i], y5[i], x6[i+1], y6[i+1], x6[i], y6[i]);
triangle(x5[i]+a, y5[i]+a*slope5[i], x5[i]+b, y6[i]+b*slope6[i], x6[i], y6[i]);
triangle(x5[i]+c, y5[i]+c*slope5[i], x5[i]+d, y6[i]+d*slope6[i], x6[i+1], y6[i+1]);
triangle(x5[i+1], y5[i+1], x5[i]+c, y5[i]+c*slope5[i], x6[i+1], y6[i+1]);
}
else if(chance ==3)
{
line(x5[i] + a, y5[i]+a*slope5[i], x5[i] + a, (y6[i])+a*slope6[i]);
line(x5[i] + b, y5[i]+b*slope5[i], x5[i] + b, (y6[i])+b*slope6[i]);
line(x5[i] + c, y5[i]+c*slope5[i], x5[i] + c, (y6[i])+c*slope6[i]);
line(x5[i] + d, y5[i]+d*slope5[i], x5[i] + d, (y6[i])+d*slope6[i]);
}
}
//fill 6
for(int i = 0; i< numVertex-1; i++)
{
int chance = int(random(1,6));
int a = int(random(1,40));
int b = int(random(1,40));
int c = int(random(1,40));
int d = int(random(1,40));
if(chance == 1)
{
triangle(x6[i], y6[i], x6[i+1], y6[i+1], x7[i], y7[i]);
triangle(x6[i], y6[i], x7[i+1], y7[i+1], x7[i], y7[i]);
triangle(x6[i]+a, y6[i]+a*slope6[i], x6[i]+b, y7[i]+b*slope7[i], x7[i], y7[i]);
triangle(x6[i]+c, y6[i]+c*slope6[i], x6[i]+d, y7[i]+d*slope7[i], x7[i+1], y7[i+1]);
triangle(x6[i+1], y6[i+1], x6[i]+c, y6[i]+c*slope6[i], x7[i+1], y7[i+1]);
}
else if(chance ==3)
{
line(x6[i] + a, y6[i]+a*slope6[i], x6[i] + a, (y7[i])+a*slope7[i]);
line(x6[i] + b, y6[i]+b*slope6[i], x6[i] + b, (y7[i])+b*slope7[i]);
line(x6[i] + c, y6[i]+c*slope6[i], x6[i] + c, (y7[i])+c*slope7[i]);
line(x6[i] + d, y6[i]+d*slope6[i], x6[i] + d, (y7[i])+d*slope7[i]);
}
}
//fill 7
for(int i = 0; i< numVertex-1; i++)
{
int chance = int(random(1,6));
int a = int(random(1,40));
int b = int(random(1,40));
int c = int(random(1,40));
int d = int(random(1,40));
if(chance == 1)
{
triangle(x7[i], y7[i], x7[i+1], y7[i+1], x8[i], y8[i]);
triangle(x7[i], y7[i], x8[i+1], y8[i+1], x8[i], y8[i]);
triangle(x7[i]+a, y7[i]+a*slope7[i], x7[i]+b, y8[i]+b*slope8[i], x8[i], y8[i]);
triangle(x7[i]+c, y7[i]+c*slope7[i], x7[i]+d, y8[i]+d*slope8[i], x8[i+1], y8[i+1]);
triangle(x7[i+1], y7[i+1], x7[i]+c, y7[i]+c*slope7[i], x8[i+1], y8[i+1]);
}
else if(chance ==3)
{
line(x7[i] + a, y7[i]+a*slope7[i], x7[i] + a, (y8[i])+a*slope8[i]);
line(x7[i] + b, y7[i]+b*slope7[i], x7[i] + b, (y8[i])+b*slope8[i]);
line(x7[i] + c, y7[i]+c*slope7[i], x7[i] + c, (y8[i])+c*slope8[i]);
line(x7[i] + d, y7[i]+d*slope7[i], x7[i] + d, (y8[i])+d*slope8[i]);
}
}
//fill 8
for(int i = 0; i< numVertex-1; i++)
{
int chance = int(random(1,6));
int a = int(random(1,40));
int b = int(random(1,40));
int c = int(random(1,40));
int d = int(random(1,40));
if(chance == 1)
{
triangle(x8[i], y8[i], x8[i+1], y8[i+1], x9[i], y9[i]);
triangle(x8[i], y8[i], x9[i+1], y9[i+1], x9[i], y9[i]);
triangle(x8[i]+a, y8[i]+a*slope8[i], x8[i]+b, y9[i]+b*slope9[i], x9[i], y9[i]);
triangle(x8[i]+c, y8[i]+c*slope8[i], x8[i]+d, y9[i]+d*slope9[i], x9[i+1], y9[i+1]);
triangle(x8[i+1], y8[i+1], x8[i]+c, y8[i]+c*slope8[i], x9[i+1], y9[i+1]);
}
else if(chance ==3)
{
line(x8[i] + a, y8[i]+a*slope8[i], x8[i] + a, (y9[i])+a*slope9[i]);
line(x8[i] + b, y8[i]+b*slope8[i], x8[i] + b, (y9[i])+b*slope9[i]);
line(x8[i] + c, y8[i]+c*slope8[i], x8[i] + c, (y9[i])+c*slope9[i]);
line(x8[i] + d, y8[i]+d*slope8[i], x8[i] + d, (y9[i])+d*slope9[i]);
}
}
//circles
for (int i=0; i<numCircle; i++)
{
float circumfrence = random(10,130);
ellipse(random(circumfrence, testHeight-circumfrence), random(circumfrence, testHeight-circumfrence), circumfrence, circumfrence);
}
click = false;
}
} |