Willkommen auf unserem Seminar-Blog

Immer auf dem aktuellen Stand bleiben

Dieser Seminar-Blog befindet sich noch im Aufbau und wird in den kommenden Tagen entsprechend verfeinert.

Member Login

Lost your password?

Registration is closed

Sorry, you are not allowed to register by yourself on this site!

You must either be invited by one of our team member or request an invitation by email at viad.info {at} zhdk {dot} ch.

Permutationen Processing – Stand 14. Dez. 2010

15. Dezember 2010

Dies ist der STand der interaktiven Permutation vom 14. Dezember 2010. Bis jetzt kann man mit den Nummerntasten '1' und '2' auswählen, wie sich die Zeichen verändern, sobald die Maus eingesetzt wird. Bei gedrückter Zahl '1' werden bestimmte Quadratelemente des Zeichens grösser, je weiter man sich in der Diagonale von links oben bis rechts unten mit der Maus bewegt. Im Modus '2' werden ebenfalls gewisse Zeichenteile vergrössert und zusätzlich noch rotiert. Geplant sind weitere Modi, in denen sich die Zeichen noch auf weitere Arten verändern. Sourcecode:

int     mEvent = 1;
int     anzahl = 7;
int     rand = 50;
float mMap1, mMap;
float mMap2;
boolean changeDirection = true;
boolean changeDirection1 = false;
float   change,change1;
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(1000, 1000);
  smooth();

  xStep = (width - 2 * rand) / (float)(anzahl-1);
  yStep = (height - 2 * rand) / (float)(anzahl-1);

  //noLoop();
}

void draw()
{
  background(255);
   switch(key)
  {
  case ' ':
    save("permutation.jpg");
    break;
    case '1':
    mEvent =1;
    println(1);
    break;
    case '2':
    mEvent =2;
    println(2);
    break;
    case '3':
    mEvent =3;
    break;
    case '4':
    mEvent =4;
    break;
   
  }
  
mMap1 = map(mouseX,width,0,0,1);
mMap2 = map(mouseY,height,0,0,1);
float t = mMap1 + mMap2;
mMap = map(t,2,0,0.5,4);

  

  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], change, change1);
         // print(str(permutationsIndexList[permutationsIndex]) + "\t");

          ++permutationsIndex;

          translate(xStep,0.0f);
        }
        println();
      popMatrix();
      translate(0.0f,yStep);
    }
  popMatrix();

}

void drawPermutationObj(int type, float c, float c1)
{
  pushStyle();
  switch(type)
  {
   case 0:
 
pushMatrix();
switch(mEvent)
  {
    case 1:
    scale(mMap);
    break;
    case 2:
    rotate(mMap);
    scale(mMap);
    break;
    case 3:
    scale(3);
    break;
    case 4:
   
    break;
   
  }
    //translate(200,200);
    //rechteck 1
    rectMode(CENTER);
    rotate(0.79);
    strokeWeight(10);
      fill(255);
      rect(0,0,60,60);
      
popMatrix();

pushMatrix();
switch(mEvent)
  {
    case 1:
    scale(mMap);
    break;
    case 2:
    rotate(mMap*2);
    
    break;
    case 3:
    scale(3);
    break;
    case 4:
   
    break;
   
  }
    //rechteck2
    //translate(200,200);
    rectMode(CENTER);
     rotate(0);
       strokeWeight(6);
       fill(255);
       rect(0,0,55,55);

popMatrix();

pushMatrix();

    //rechteck3
    //translate(200,200);
     rectMode(CENTER);
      rotate(0);
        strokeWeight(2);
        fill(255);
        rect(0,0,50,50);
        
popMatrix();

pushMatrix();
switch(mEvent)
  {
    case 1:
    scale(mMap);
    break;
    case 2:
    rotate(mMap);
    
    break;
    case 3:
    scale(3);
    break;
    case 4:
   
    break;
   
  }
     //rechteck4
     //translate(200,200);
      rectMode(CENTER);
       rotate(0.79);
         fill(0);
         rect(0,0,45,45);
         
popMatrix();
    break;

  case 1:
     pushMatrix();
switch(mEvent)
  {
    case 1:
    scale(mMap);
    break;
    case 2:
    rotate(mMap);
    scale(mMap);
    break;
    case 3:
    scale(3);
    break;
    case 4:
   
    break;
   
  }
    //translate(200,200);
    //rechteck 1
    rectMode(CENTER);
    rotate(0.79);
    strokeWeight(8);
      fill(255);
      rect(0,0,55,55);
      
popMatrix();

pushMatrix();
switch(mEvent)
  {
    case 1:
    scale(mMap);
    break;
    case 2:
    rotate(mMap*2);
    
    break;
    case 3:
    scale(3);
    break;
    case 4:
   
    break;
   
  }
    //rechteck2
    //translate(200,200);
    rectMode(CENTER);
     rotate(0);
       strokeWeight(5);
       fill(255);
       rect(0,0,48,48);

popMatrix();

pushMatrix();
switch(mEvent)
  {
    case 1:
    scale(mMap);
    break;
    case 2:
    rotate(mMap);
    
    break;
    case 3:
    scale(3);
    break;
    case 4:
   
    break;
   
  }
    //rechteck3
    //translate(200,200);
     rectMode(CENTER);
      rotate(0);
        strokeWeight(2);
        fill(255);
        rect(0,0,45,45);
        
popMatrix();

pushMatrix();
switch(mEvent)
  {
    case 1:
    scale(mMap);
    break;
    case 2:
    rotate(mMap);
    
    break;
    case 3:
    scale(3);
    break;
    case 4:
   
    break;
   
  }
     //rechteck4
     //translate(200,200);
      rectMode(CENTER);
       rotate(0.79);
         fill(0);
         rect(0,0,40,40);
         
popMatrix();
    break;

  case 2:
     pushMatrix();
switch(mEvent)
  {
    case 1:
    scale(mMap);
    break;
    case 2:
    rotate(mMap);
    scale(mMap);
    break;
    case 3:
    scale(3);
    break;
    case 4:
   
    break;
   
  }
    //translate(200,200);
    //rechteck 1
    rectMode(CENTER);
    rotate(0.79);
    strokeWeight(7);
      fill(255);
      rect(0,0,50,50);
      
popMatrix();

pushMatrix();
switch(mEvent)
  {
    case 1:
    scale(mMap);
    break;
    case 2:
    rotate(mMap*2);
    
    break;
    case 3:
    scale(3);
    break;
    case 4:
   
    break;
   
  }
    //rechteck2
    //translate(200,200);
    rectMode(CENTER);
     rotate(0);
       strokeWeight(4);
       fill(255);
       rect(0,0,46,46);

popMatrix();

pushMatrix();
switch(mEvent)
  {
    case 1:
    scale(mMap);
    break;
    case 2:
    rotate(mMap);
    
    break;
    case 3:
    scale(3);
    break;
    case 4:
   
    break;
   
  }
    //rechteck3
    //translate(200,200);
     rectMode(CENTER);
      rotate(0);
        strokeWeight(2);
        fill(255);
        rect(0,0,40,40);
        
popMatrix();

pushMatrix();
switch(mEvent)
  {
    case 1:
    scale(mMap);
    break;
    case 2:
    rotate(mMap);
    
    break;
    case 3:
    scale(3);
    break;
    case 4:
   
    break;
   
  }
     //rechteck4
     //translate(200,200);
      rectMode(CENTER);
       rotate(0.79);
         fill(0);
         rect(0,0,35,35);
         
popMatrix();
    break;

  case 3:
     pushMatrix();
switch(mEvent)
  {
    case 1:
    scale(mMap);
    break;
    case 2:
    rotate(mMap);
    scale(mMap);
    break;
    case 3:
    scale(3);
    break;
    case 4:
   
    break;
   
  }
    //translate(200,200);
    //rechteck 1
    rectMode(CENTER);
    rotate(0.79);
    strokeWeight(6);
      fill(255);
      rect(0,0,45,45);
      
popMatrix();

pushMatrix();
switch(mEvent)
  {
    case 1:
    scale(mMap);
    break;
    case 2:
    rotate(mMap*2.5);
    
    break;
    case 3:
    scale(3);
    break;
    case 4:
   
    break;
   
  }
    //rechteck2
    //translate(200,200);
    rectMode(CENTER);
     rotate(0);
       strokeWeight(3);
       fill(255);
       rect(0,0,44,44);

popMatrix();

pushMatrix();
switch(mEvent)
  {
    case 1:
    scale(mMap);
    break;
    case 2:
    rotate(mMap);
    
    break;
    case 3:
    scale(3);
    break;
    case 4:
   
    break;
   
  }
    //rechteck3
    //translate(200,200);
     rectMode(CENTER);
      rotate(0);
        strokeWeight(2);
        fill(255);
        rect(0,0,35,35);
        
popMatrix();

pushMatrix();
switch(mEvent)
  {
    case 1:
    scale(mMap);
    break;
    case 2:
    rotate(mMap);
    
    break;
    case 3:
    scale(3);
    break;
    case 4:
   
    break;
   
  }
     //rechteck4
     //translate(200,200);
      rectMode(CENTER);
       rotate(0.79);
         fill(0);
         rect(0,0,30,30);
         
popMatrix();
    break;

  case 4:
     pushMatrix();
switch(mEvent)
  {
    case 1:
    scale(mMap);
    break;
    case 2:
    rotate(mMap);
    scale(mMap);
    break;
    case 3:
    scale(3);
    break;
    case 4:
   
    break;
   
  }
    //translate(200,200);
    //rechteck 1
    rectMode(CENTER);
    rotate(0.79);
    strokeWeight(5);
      fill(255);
      rect(0,0,40,40);
      
popMatrix();

pushMatrix();
switch(mEvent)
  {
    case 1:
    scale(mMap);
    break;
    case 2:
    rotate(mMap*3);
    
    break;
    case 3:
    scale(3);
    break;
    case 4:
   
    break;
   
  }
    //rechteck2
    //translate(200,200);
    rectMode(CENTER);
     rotate(0);
       strokeWeight(2);
       fill(255);
       rect(0,0,42,42);

popMatrix();

pushMatrix();
switch(mEvent)
  {
    case 1:
    scale(mMap);
    break;
    case 2:
    rotate(mMap);
    
    break;
    case 3:
    scale(3);
    break;
    case 4:
   
    break;
   
  }
    //rechteck3
    //translate(200,200);
     rectMode(CENTER);
      rotate(0);
        strokeWeight(2);
        fill(255);
        rect(0,0,30,30);
        
popMatrix();

pushMatrix();
switch(mEvent)
  {
    case 1:
    scale(mMap);
    break;
    case 2:
    rotate(mMap);
    
    break;
    case 3:
    scale(3);
    break;
    case 4:
   
    break;
   
  }
     //rechteck4
     //translate(200,200);
      rectMode(CENTER);
       rotate(0.79);
         fill(0);
         rect(0,0,25,25);
         
popMatrix();
    break;
  
  case 5:
     pushMatrix();
switch(mEvent)
  {
    case 1:
    scale(mMap);
    break;
    case 2:
    rotate(mMap);
    scale(mMap);
    break;
    case 3:
    scale(3);
    break;
    case 4:
   
    break;
   
  }
    //translate(200,200);
    //rechteck 1
    rectMode(CENTER);
    rotate(0.79);
    strokeWeight(4);
      fill(255);
      rect(0,0,35,35);
      
popMatrix();

pushMatrix();
switch(mEvent)
  {
    case 1:
    scale(mMap);
    break;
    case 2:
    rotate(mMap*3.5);
    
    break;
    case 3:
    scale(3);
    break;
    case 4:
   
    break;
   
  }
    //rechteck2
    //translate(200,200);
    rectMode(CENTER);
     rotate(0);
       strokeWeight(1);
       fill(255);
       rect(0,0,40,40);

popMatrix();

pushMatrix();
switch(mEvent)
  {
    case 1:
    scale(mMap);
    break;
    case 2:
    rotate(mMap);
    
    break;
    case 3:
    scale(3);
    break;
    case 4:
   
    break;
   
  }
    //rechteck3
    //translate(200,200);
     rectMode(CENTER);
      rotate(0);
        strokeWeight(2);
        fill(255);
        rect(0,0,25,25);
        
popMatrix();

pushMatrix();
switch(mEvent)
  {
    case 1:
    scale(mMap);
    break;
    case 2:
    rotate(mMap);
    
    break;
    case 3:
    scale(3);
    break;
    case 4:
   
    break;
   
  }
     //rechteck4
     //translate(200,200);
      rectMode(CENTER);
       rotate(0.79);
         fill(0);
         rect(0,0,20,20);
         
popMatrix();
    break;

  case 6:
     pushMatrix();
switch(mEvent)
  {
    case 1:
    scale(mMap);
    break;
    case 2:
    rotate(mMap);
    scale(mMap);
    break;
    case 3:
    scale(3);
    break;
    case 4:
   
    break;
   
  }
    //translate(200,200);
    //rechteck 1
    rectMode(CENTER);
    rotate(0.79);
    strokeWeight(3);
      fill(255);
      rect(0,0,30,30);
      
popMatrix();

pushMatrix();
switch(mEvent)
  {
    case 1:
    scale(mMap);
    break;
    case 2:
    rotate(mMap*4);
    
    break;
    case 3:
    scale(3);
    break;
    case 4:
   
    break;
   
  }
    //rechteck2
    //translate(200,200);
    rectMode(CENTER);
     rotate(0);
       strokeWeight(0);
       fill(255);
       rect(0,0,38,38);

popMatrix();

pushMatrix();
switch(mEvent)
  {
    case 1:
    scale(mMap);
    break;
    case 2:
    rotate(mMap);
    
    break;
    case 3:
    scale(3);
    break;
    case 4:
   
    break;
   
  }
    //rechteck3
    //translate(200,200);
     rectMode(CENTER);
      rotate(0);
        strokeWeight(2);
        fill(255);
        rect(0,0,20,20);
        
popMatrix();

pushMatrix();
switch(mEvent)
  {
    case 1:
    scale(mMap);
    break;
    case 2:
    rotate(mMap);
    
    break;
    case 3:
    scale(3);
    break;
    case 4:
   
    break;
   
  }
     //rechteck4
     //translate(200,200);
      rectMode(CENTER);
       rotate(0.79);
         fill(0);
         rect(0,0,15,15);
         
popMatrix();
    break;

  default:
    break;
  }
  popStyle();
}