1. Dezember 2010
For our 10 assignment we had to create our permutations in Processing. This was a fun assignment to tackle mostly because It would allow total control of all the forms that are built to make our permutations and shapes. After altering the single forms I encountered my first problem with the masking of the objects. Because one gets larger it was interfering with the other shapes as seen in the following picture;![](../../../../files/2010/12/Screen-shot-2010-12-01-at-11.12.38-PM-300x81.png)
![](../../../../files/2010/12/Screen-shot-2010-12-01-at-11.46.00-PM-298x300.png)
![](../../../../files/2010/12/Screen-shot-2010-12-02-at-12.00.03-AM1-300x298.png)
int anzahl = 7; int rand = 50; float xStep; float yStep; float rotation = radians (45); 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], rotation); print(str(permutationsIndexList[permutationsIndex]) + "\t"); ++permutationsIndex; translate(xStep,0.0f); } println(); popMatrix(); translate(0.0f,yStep); } popMatrix(); } void drawPermutationObj(int type, float rotation) //implemented float rotation to have the forms turn slightly { pushStyle(); noStroke(); switch(type) { case 0: fill(0); ellipse(0,0,75,75); fill(255); triangle (0,-37,32,18,-32,18); fill(0); ellipse(0,0,32,32); fill(255); triangle (0,-15,14,9,-14,9); break; case 1: fill(0); ellipse(0,0,75,75); fill(255); pushMatrix(); scale(1.2); rotate(rotation); //rotate(radians(15)); triangle (0,-37,32,18,-32,18); popMatrix(); fill(0); pushMatrix(); scale(1.2); ellipse(0,0,32,32); fill(255); popMatrix(); pushMatrix(); scale(1.2); rotate(-rotation); //rotate(radians(-15)); triangle (0,-15,14,9,-14,9); popMatrix(); break; case 2: fill(0); ellipse(0,0,75,75); fill(255); pushMatrix(); scale(1.4); rotate(rotation); //rotate(radians(30)); triangle (0,-37,32,18,-32,18); popMatrix(); fill(0); pushMatrix(); scale(1.4); ellipse(0,0,32,32); fill(255); popMatrix(); pushMatrix(); scale(1.4); rotate(-rotation); //rotate(radians(-30)); triangle (0,-15,14,9,-14,9); popMatrix(); break; case 3: fill(0); ellipse(0,0,75,75); fill(255); pushMatrix(); scale(1.6); rotate(rotation); //rotate(radians(45)); triangle (0,-37,32,18,-32,18); popMatrix(); fill(0); pushMatrix(); scale(1.6); ellipse(0,0,32,32); fill(255); popMatrix(); pushMatrix(); scale(1.6); rotate(-rotation); //rotate(radians(-45)); triangle (0,-15,14,9,-14,9); popMatrix(); break; case 4: fill(0); ellipse(0,0,75,75); fill(255); pushMatrix(); scale(1.8); rotate(rotation); //rotate(radians(50)); triangle (0,-37,32,18,-32,18); popMatrix(); fill(0); pushMatrix(); scale(1.8); ellipse(0,0,32,32); fill(255); popMatrix(); pushMatrix(); scale(1.8); rotate(-rotation); //rotate(radians(-50)); triangle (0,-15,14,9,-14,9); popMatrix(); break; case 5: fill(0); ellipse(0,0,75,75); fill(255); pushMatrix(); scale(2); rotate(rotation); //rotate(radians(65)); triangle (0,-37,32,18,-32,18); popMatrix(); fill(0); pushMatrix(); scale(2); ellipse(0,0,32,32); fill(255); popMatrix(); pushMatrix(); scale(2); rotate(-rotation); //rotate(radians(-65)); triangle (0,-15,14,9,-14,9); popMatrix(); break; case 6: fill(0); ellipse(0,0,75,75); fill(255); pushMatrix(); scale(2.2); rotate(rotation); //rotate(radians(80)); triangle (0,-37,32,18,-32,18); popMatrix(); fill(0); pushMatrix(); scale(2.2); ellipse(0,0,32,32); fill(255); popMatrix(); pushMatrix(); scale(2.2); rotate(-rotation); //rotate(radians(-80)); triangle (0,-15,14,9,-14,9); popMatrix(); break; default: break; } popStyle(); } void keyPressed() { switch(key) { case ' ': save("permutation.jpg"); break; } }