Piet Mondrian Assignment(Suruchika)

We needed to choose one of Piet Mondrian art piece and recreate it using a Processing program.

The painting I chose:

Program :

// Program to recreate Piet Mondrian painting - dimensions of the painting can be altered

int l=540,b=570;
void setup()
{
size(l,b);
background(255,255,255);
}

void draw()
{
int x1=0,x2=0,y1=0,y2=0;len=0;br=0;

//yellow block
stroke(234,193,7);
fill(228,186,3);
len=int(l*0.1148);br=int(b*0.211);
rect(x1,y1,len,br);

stroke(50,108,158);
strokeWeight(15);
x1=int(l*0.1389);y1=int(b*0.895);x2=int(l*0.38);y2=y1;
line(x1,y1,x2,y2);

stroke(185,30,0);
x1=int(l*0.972);x2=int(l);
line(x1,y1,x2,y2);

//red block
stroke(185,30,0);
fill(185,30,0);
x1=int(l*0.611);y1=int(b*0.688);len=int(l*0.1593);br=int(b*0.1544);
rect(x1,y1,len,br);

stroke(5,4,0);

// vertical lines
strokeWeight(10);

x1=x2=int(l*0.1296);
line(x1,0,x2,b);
x1=x2=int(l*0.25);
line(x1,0,x2,b);
x1=x2=int(l*0.333);
line(x1,0,x2,b);
x1=x2=int(l*0.389);
line(x1,0,x2,b);
x1=x2=int(l*0.593);
line(x1,0,x2,b);
x1=x2=int(l*0.787);
line(x1,0,x2,b);
x1=x2=int(l*0.852);
line(x1,0,x2,b);
x1=x2=int(l*0.963);
line(x1,0,x2,b);

// horizontal lines
strokeWeight(13);

y1=y2=int(b*0.228);
line(0,y1,l,y2);
y1=y2=int(b*0.377);
line(0,y1,l,y2);
y1=y2=int(b*0.491);
line(0,y1,l,y2);
y1=y2=int(b*0.667);
line(0,y1,l,y2);
x1=int(l*0.596);y1=y2=int(b*0.8597);x2=int(l*0.848);
line(x1,y1,x2,y2);
y1=y2=int(b*0.965);
line(x1,550,x2,550);

}

for l=300 b=340

output:

page revision: 17, last edited: 05 Sep 2008 05:13