8. Dezember 2010
...endlich. Nach vielen Stunden habe ich es doch noch geschafft, dass sich die Kreise drehen. Nach links nämlich, rechts würde auch gehen. Dank geht an Thomas für die Hilfe beim Drehcode!![](../../../../files/2010/12/drehpermutation-300x300.jpg)
![](../../../../files/2010/12/drehpermutation1-300x300.jpg)
int anzahl = 7; int rand = 50; float f = 0; 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++) { f += 0.1; drawPermutationObj(permutationsIndexList[permutationsIndex],f); print(str(permutationsIndexList[permutationsIndex]) + "\t"); ++permutationsIndex; translate(xStep,0.0f); } println(); popMatrix(); translate(0.0f,yStep); } popMatrix(); } float rot=0; void drawPermutationObj(int type, float c) { pushStyle(); switch(type) { case 0: rot +=0; pushMatrix(); rotate(radians(-c)); 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); popMatrix(); break; case 1: rot +=0; pushMatrix(); rotate(radians(-c)); 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); popMatrix(); break; case 2: rot +=0; pushMatrix(); rotate(radians(-c)); 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); popMatrix(); break; case 3: rot +=0; pushMatrix(); rotate(radians(-c)); 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); popMatrix(); break; case 4: rot +=0; pushMatrix(); rotate(radians(-c)); 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); popMatrix(); break; case 5: rot +=0; pushMatrix(); rotate(radians(-c)); 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); popMatrix(); break; case 6: rot +=0; pushMatrix(); rotate(radians(-c)); 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); popMatrix(); break; default: break; } popStyle(); } void keyPressed() { switch(key) { case 'p': save("drehpermutation1.jpg"); break; } }