8. Dezember 2010
Hier noch eine Permutation mit Kreisen und stärkerem Schwarz-Weiss-Kontrast. Bei der Übernahme der Permutation aus Illustrator habe ich diesmal darauf geachtet, dass ich nicht mit "translate" arbeiten musste und die Zentren der Kreise gleich lagen. Hat funktioniert. code:int anzahl = 7; int rand = 50; float xStep; float yStep; int[] permutationsIndexList = {0, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 5, 2, 3, 4, 5, 6, 5, 4, 3, 4, 5, 6, 5, 4, 3, 4, 5, 6, 5, 4, 3, 2, 5, 6, 5, 4, 3, 2, 1, 6, 5, 4, 3, 2, 1, 0}; void setup() { size(600, 600); smooth(); xStep = (width - 2 * rand) / (float)(anzahl-1); yStep = (height - 2 * rand) / (float)(anzahl-1); noLoop(); } void draw() { background(255); int permutationsIndex = 0; pushMatrix(); translate(rand,rand); for(int y=0; y<anzahl;y++) { pushMatrix(); for(int x=0; x<anzahl;x++) { drawPermutationObj(permutationsIndexList[permutationsIndex]); print(str(permutationsIndexList[permutationsIndex]) + "\t"); ++permutationsIndex; translate(xStep,0.0f); } println(); popMatrix(); translate(0.0f,yStep); } popMatrix(); } void drawPermutationObj(int type) { pushStyle(); switch(type) { case 0: stroke(0); fill(0); ellipse(0,0,75,75); fill(255); ellipse(2,0,55,55); noFill(); strokeWeight(6); ellipse(-9,0,45,45); fill(0); ellipse(-15,0,23,23); break; case 1: stroke(0); fill(0); ellipse(0,0,75,75); fill(255); ellipse(2,0,57,57); noFill(); strokeWeight(6); ellipse(-9.2,0,43,43); fill(0); ellipse(-15,-1,23,23); fill(0); ellipse(-14.5,-1.6,21,21); break; case 2: stroke(0); fill(0); ellipse(0,0,75,75); fill(255); ellipse(0,0,59,59); noFill(); strokeWeight(5); ellipse(-9.4,-2,40,40); fill(0); ellipse(-14.5,-3.2,19,19); break; case 3: stroke(0); fill(0); ellipse(0,0,75,75); fill(255); ellipse(0,0,61,61); noFill(); strokeWeight(5); ellipse(-9.6,-3,38,38); fill(0); ellipse(-13.5,-4.8,17,17); break; case 4: stroke(0); fill(0); ellipse(0,0,75,75); fill(255); ellipse(0,0,66,66); noFill(); strokeWeight(5); ellipse(-9.7,-4,35,35); fill(0); ellipse(-13,-6.4,15,15); break; case 5: stroke(0); fill(0); ellipse(0,0,75,75); fill(255); ellipse(0,0,68,68); noFill(); strokeWeight(5); ellipse(-9.9,-6,33,33); fill(0); ellipse(-12.5,-8,13,13); break; case 6: stroke(0); fill(0); ellipse(0,0,75,75); fill(255); ellipse(0,0,70,70); noFill(); strokeWeight(4); ellipse(-10,-7,30,30); fill(0); ellipse(-12,-10,10,10); break; default: break; } popStyle(); } void keyPressed() { switch(key) { case 's': save("permutation.jpg"); break; } }