We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexDiscussionExhibition › 2nd Project: Organic-Form-Generator
Page Index Toggle Pages: 1
2nd Project: Organic-Form-Generator (Read 457 times)
2nd Project: Organic-Form-Generator
Feb 5th, 2010, 11:48am
 
hello boys and girls,

as i promised, here is my second small sketch.
(once again inspired by "generative gestaltung")

and like the one before, i did this to learn processing too.
in this case especially the curveVertex and the handling of agents.

you can get very different results
by changing the variables.
start with "tempstrokeWeight"
in- and decrease it in 0.5 steps an see what happens...

enjoy.
ingo




Code:

// uncomment the line below for pdf-generator (and line 32, 33 and 105)
//(each time you start the program or push the mouse button, a new pdf-file will be created)
//
//import processing.pdf.*;

int formResolution = 5;
int stepSize = 5;
int count = 200;
float tempstrokeWeight = 1;
float initRadius = 150;

int look02 = 200;
int look04 = 300;

float centerX, centerY;
float[] x = new float[formResolution];
float[] y = new float[formResolution];



void setup(){

size(1200, 800);
smooth();
stroke(0, 50);
background(255);
strokeWeight(tempstrokeWeight);


// endRecord();
// beginRecord(PDF, "Screen.pdf");


centerX = width/2;
centerY = height/2;

float angle = radians(360/float(formResolution));
for (int i=0; i<formResolution; i++){
x[i] = cos(angle*i) * initRadius;
y[i] = sin(angle*i) * initRadius;

}

for (int k=0; k<count; k++){
stroke(0, (255/count*k), 120, 30);



for (int i=0; i<formResolution; i++){


///////////////////////// Coment/Uncoment these lines for different results


// ------------Look 01
//
// x[i] += random(-stepSize, stepSize);
// y[i] += random(-stepSize, stepSize);


// ------------Look 01 (more open than 01)

x[i] += random(-stepSize, stepSize);
y[i] += random(-stepSize, stepSize);
x[i] += random(cos(angle*i) * initRadius /look02);
y[i] += random(sin(angle*i) * initRadius /look02);


// ------------Look 03
//
// x[i] = cos(angle*random(-i, i) +PI/2) * initRadius;
// y[i] = sin(angle*random(-i, i) +0.5) * initRadius;


// ------------Look 04

// x[i] += random(cos(angle*i) * initRadius /look04);
// y[i] += random(sin(angle*i) * initRadius / look04);


}

noFill();

beginShape();

curveVertex(x[formResolution-1]+centerX, y[formResolution-1]+centerY);
for (int i=0; i<formResolution; i++){
curveVertex(x[i]+centerX, y[i]+centerY);
}
curveVertex(x[0]+centerX, y[0]+centerY);


curveVertex(x[1]+centerX, y[1]+centerY);

endShape();

}

// uncomment this for pdf
//(each time you start the program or push the mouse button, a new pdf-file will be created)
//
// endRecord();


}


void draw(){

}

void mousePressed() {
setup();
}


Page Index Toggle Pages: 1