Generative Illustrationen für magazin ›neues museum‹ 15-3

Generative Illustrationen für magazin ›neues museum‹ 15-3

cover-1-1
kern-4
kern-5
kern-6
abstract 1-5
illu-1-1

// --------------------------------------------------
// Generative Illustrations for ›neues museum‹
// Language: Processing
// Author: Andreas Pirchner
// --------------------------------------------------
import processing.pdf.*;

int dotNumber = 5;
int size = 800;

PVector[] points = new PVector[dotNumber];
PVector[] oldpoints = new PVector[dotNumber];
float [] speeds = new float[dotNumber];
float[] radius = new float[dotNumber];
float[] rotation = new float[dotNumber];
float[] sizes = new float[dotNumber];
boolean[] visible = new boolean[dotNumber];

PVector v1, v2, v3, speed ;
int areaWidth, areaHeight;

float originX, originY;
float currentRotationNumber;
int counter = 0;
float visProbability = 0.9;
boolean fillColorBlack = true;

Element[] Elements;

void setup() {
beginRaw(PDF, "everything.pdf");
frameRate(120);
size(1400,1400, P3D);
v1 = new PVector(40, 20, 0);
background(255);
stroke(0,0,0,179);
fill(0,0,0,100);
// v2 = new PVector(25, 50, 0);

int[] confHydrogen = new int[1];
int[] confHelium = new int[1];
int[] confLithium = new int[2];
int[] confBerylium = new int[2];
int[] confLead = new int[6];
confHydrogen[0] = 1;
confHelium[0] = 2;
confLithium[0] = 2;
confLithium[1] = 1;
confBerylium[0] = 2;
confBerylium[1] = 2;
confLead[0] = 2;
confLead[1] = 8;
confLead[2] = 18;
confLead[3] = 32;
confLead[4] = 18;
confLead[5] = 4;

//Elements[1] = new Element(1,"H","Hydrogen",1, confHydrogen,"Diatomic nonmetal");
//Elements[2] = new Element(2,"He","Helium",1, confHelium,"Diatomic nonmetal");
//Elements[3] = new Element(3,"Li","Lithium",1, confLithium,"Diatomic nonmetal");
//Elements[4] = new Element(4,"Be","Berlyium",1, confBerylium,"Diatomic nonmetal");
//Elements[5] = new Element(82,"Pl","Lead",1, confLead,"Diatomic nonmetal");

areaWidth = 360;
areaHeight = 360;
originX = width/2;
originY = height/2;

for (int i=0; i<points.length; i++) {
points[i] = new PVector(random(-size, size), random(-size, size));
oldpoints[i] = points[i];
radius[i] = points[i].mag();
rotation[i] = points[i].heading();
sizes[i] = random(1,4);
speeds[i] = random(-0.008,0.008);
visible[i] = true;
}

}

void draw() {
//background(255,255,255,0.01);
translate(width/2,height/2,0);
counter ++;
if (counter < 200){
for (int i=0; i<points.length; i++) {

rotation[i] += speeds[i];
points[i].x = 0 + radius[i]*cos(rotation[i]) * sin(rotation[i]);
points[i].y = -radius[i]/2 + radius[i]*sin(rotation[i]) * sin(rotation[i]);

if (visible[i] == true && i>0){
//point(points[i].x,points[i].y,points[i].z);
//ellipse(points[i].x,points[i].y,sizes[i],sizes[i]);
stroke(0,0,0,179);
strokeWeight(0.25);
//line(oldpoints[i].x,oldpoints[i].y, points[i].x, points[i].y);
line(points[i-1].x,points[i-1].y, points[i].x, points[i].y);
//line(0,0, points[i].x, points[i].y);
noStroke();
}
/*if (random(0,1) > visProbability){
visible[i] = !visible[i];
}*/
oldpoints[i].x = points[i].x;
oldpoints[i].y = points[i].y;

}

if (random(0,1) > 0.99){
fillColorBlack = !fillColorBlack;
float farbModus = random(1);
if (farbModus <= 0.8){
//fill(0,0,0,100);
stroke(0,0,0,179);
noStroke();
print("schwarz");

} else if (farbModus > 0.5){
//fill(255,255,255,200);
stroke(255,255,255,179);
noStroke();
print("weiss");
}
}
}

}

void keyPressed() {
if (key == 'q') {
endRaw();
exit();
}
}

class Element {
int atomicnumber;
String symbol;
String name;
float mass;
String group;
int[] electronconfig;

Element(int TEMPatomicnumber, String TEMPsymbol, String TEMPname, float TEMPmass, int[] TEMPelectronconfig, String TEMPgroup){
atomicnumber = TEMPatomicnumber;
symbol = TEMPsymbol;
name = TEMPname;
mass = TEMPmass;
group = TEMPgroup;
electronconfig = new int[TEMPelectronconfig.length];

for (int i=0; i < TEMPelectronconfig.length; i++){
electronconfig[i] = TEMPelectronconfig[i];
}
//display();
}

void display(){
int xPos = Math.round(random(width));
int yPos = Math.round(random(height));
float angle = 0;
float xPosE = 0;
float yPosE = 0;
int radiusE = 4;

fill(0,0,0);
ellipse(xPos,yPos,3,3);

for (int i=0; i < electronconfig.length; i++){
//zeichne Schale
stroke(1);
noFill();
//ellipse(xPos,yPos,(i+1)*20,(i+1)*20);

//zeichne Elektronen auf Schale
for (int j=0; j < electronconfig[i]; j++){
fill(0,0,0);
noStroke();

angle = random(360);
xPosE = xPos+((i+1)*10*cos(angle));
yPosE = yPos+((i+1)*10*sin(angle));

ellipse(xPosE,yPosE,radiusE,radiusE);
}
}

}
}