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.

IAD Technoloogie Grundlagen 1 Woche 2

8. November 2011

Die Sierpinski Pyramide der ersten Woche habe ich erweitert und den Code ersetzt. Die Iteration lässt sich nun mit den Tasten 1-9 verändern. Des weiteren habe ich eine 3D Kamera hinzugefügt, welche sich mit der Maus bewegen lässt. Meine Kentnisse erweiterte ich in dieser Woche um Klassen. In den Nächsten Aufgaben habe ich einen simple SBB Bahnhofsuhr und ein einfaches UI (Slider und Checkbox) erstellt.                           qdew.
import processing.opengl.*;
void setup()
{
  size(400, 400,OPENGL);
  smooth();
}

void draw()
{
  background(255); 
translate(width/2, height/2);
stroke(0, 0, 0);
  Uhr();
  
  std();
  mi();
  stroke(255, 0, 0);
  sec();
}


void keyPressed()
{
  switch(key)
  {
  case 's':
    save("screenShot.jpg");
    println("save the screen to screenShot.jpg");
    break;
  }
}


void Uhr()
{
  foif();
   pushMatrix();
  rotateZ(radians(30));
foif();
pushMatrix();
  rotateZ(radians(30));
foif();
pushMatrix();
  rotateZ(radians(30));
foif();
pushMatrix();
  rotateZ(radians(30));
foif();
pushMatrix();
  rotateZ(radians(30));
foif();
pushMatrix();
  rotateZ(radians(30));
foif();
pushMatrix();
  rotateZ(radians(30));
foif();
pushMatrix();
  rotateZ(radians(30));
foif();
pushMatrix();
  rotateZ(radians(30));
foif();
pushMatrix();
  rotateZ(radians(30));
foif();
pushMatrix();
  rotateZ(radians(30));
foif();
popMatrix();
popMatrix();
popMatrix();
popMatrix();
popMatrix();
popMatrix();
popMatrix();
popMatrix();
popMatrix();
popMatrix();
popMatrix();

}

void foif()
{
  fill(0,0,0);
    pushMatrix();
  rotateZ(radians(-25));
  rect(-2,-110, 4, 10);
    pushMatrix();
  rotateZ(radians(6));
  rect(-2,-110, 4, 10);
    pushMatrix();
  rotateZ(radians(6));
  rect(-2,-110, 4, 10);
   pushMatrix();
  rotateZ(radians(6));
  rect(-2,-110, 4, 10);
  pushMatrix();
rotateZ(radians(6));
rect(-4,-110, 8, 30);
popMatrix();
popMatrix();
popMatrix();
popMatrix();
popMatrix();
}


void sec()
{
  
  float sec = second();
  
    sec = sec*6;
pushMatrix();
rotateZ(radians(sec+180));
fill(255,0,0,255);
   beginShape();
  vertex(-1,-20,3);
  vertex(1,-20,3);
  vertex(1,80,3);
  vertex(-1,80,3);
  endShape(CLOSE);
  ellipse(0,80,20,20);

  popMatrix();
  
}


void mi()
{
  fill(0,0,0);
  float mi = minute();
  
 mi = (mi*6);
pushMatrix();
rotateZ(radians(mi+180));

  beginShape();
  vertex(-4,-20,2);
  vertex(4,-20,2);
  vertex(4,100,2);
  vertex(-4,100,2);
  endShape(CLOSE);
  println(mi);
  popMatrix();
}

void std()
{
  fill(0,0,0);
  float std = hour();
  
 std = std*30+180+minute()/3;
pushMatrix();
rotateZ(radians(std));

   beginShape();
  vertex(5,-20,1);
  vertex(-5,-20,1);
  vertex(-5,80,1);
  vertex(5,80,1);
  endShape(CLOSE);
  println(std);
  popMatrix();
}