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.

Tangled Fractals

4. Oktober 2012

Third Day: What we learnt that day was creating something called "fractals". To simply explain what "fractals" are: It is like broccoli or cauliflower, where the branches which sprout out from the main plant looks exactly like the main branch (just miniature ones). What was new in this lesson was recursive functions. Recursive basically means involving a process which continues to repeat again and again. With this function, creating fractals became possible. Through changing numbers and experimenting with the ranges, it was possible to see how wide the fractals would "grow" or how dense it could be. What was left was experimenting on how it could look more eye-capturing or how I could control the number of fractals, due to the fact that the number of fractals were on random despite its limitations. Instead of experimenting however, the watch on my wrist caught my eye and I suddenly wondered how the interior of a clock worked. How many cogs must it take to make a clock work and does the interior of each clock look different? I found myself already constructing the cogs before I knew it.
void setup()
{
 size(600,600); // def. fenstergroesse

randomSeed(millis()); // seed random

smooth(); // aktiviere antialiasing
 strokeWeight(5); // linienbreite
 fill(0);
 stroke(0,0,0,225);

noLoop();
}

void draw()
{
 background(255);

pushMatrix();
 translate(width *.5,height - 20);
 wurzel(5);
 popMatrix();
}

void keyPressed()
{
 redraw();
}

//funktion
void wurzel(int tiefe)
{
 if(tiefe <=0) // teste ob das ende erreicht worden ist
 {
 // zeichen blueten

 pushMatrix();

 rotate(frameCount);

 pushStyle();
 int clr = (int)random(100,255);
 stroke(clr+40, clr, 0, 225);
 scale(3);
 fill(clr+50,clr+100,225);
 ellipse(0,0,180,180);
 line(-90, 0, 90, 0);
 line(0, -90, 0, 90);
 line(-63, -63, 63, 63);
 line(-63, 63, 63, -63);

// pushStyle();

// popStyle();
//
 pushStyle();
 fill(clr+50,clr+100,255);
 stroke(clr+40, clr, 0, 255);
 ellipse(0,0,90,90);
 ellipse(0,0,20,20);

 line(-7,110,7,110);
 line(7,90,7,110);
 line(-7,90,-7,110);

 line(7,-90,7,-110);
 line(-7,-110,7,-110);
 line(-7,-110,-7,-90);

 line(-90,-7,-110, -7);
 line(-110,-7,-110,7);
 line(-110,7,-90,7);

 line(90,-7,110,-7);
 line(110,-7,110,7);
 line(110,7,90,7);

 line(83,73,70,60);
 line(83,73,73,83);
 line(73,83,59,68);

 line(-83,-73,-70,-60);
 line(-83,-73,-73,-83);
 line(-73,-83,-59,-68);

 line(-83,73,-70,60);
 line(-83,73,-73,83);
 line(-73,83,-59,68);

 line(83,-73,70,-60);
 line(83,-73,73,-83);
 line(73,-83,59,-68);

 popStyle();

 popStyle();

 popMatrix();

return;
 }

// zeichne zweige
 int x;
 int y;
 //int z;
 int count = int (random(2,2));
 for(int i = 0; i < count;i++)
 {
 x = (int)random(-100,100);
 y = -(int)random(10,150);
 //z = -(int)random(-100,100);

// pushStyle();
// strokeWeight(10);
// fill(255);
// line(0,0,x/2,y/2);
// popStyle();
//
// pushStyle();
// fill(255);
// line(0,0,x/2,y/2);
// popStyle();
//
// pushStyle();
// strokeWeight(10);
// fill(255);
// line(0,0,x/2,y/2);
// popStyle();

frameRate(2);
 pushMatrix();
 translate(x,y);
 //translate(z);
 scale(random(.3,.95));
 wurzel(tiefe/2);
 popMatrix();
 }
}
<pre>

However, during the task I hit a wall: The "noLoop" was active. So how was I supposed to make my cogs turn continuously while indicating that a new arrangement of fractals should be made when any key is pressed? To solve this problem, I'll still need some time to get the hang of processing. So for now, I'm still trying to make it happen and experimenting with my possibilities.

Least did I know that my sudden experiment connected swiftly to the next assignment...

********************************************************

SMALL EXCURSION: “Adding Planets to our System”

New: PShape, PImage

With these two new classes, I could add in a group of pictures I drew (either by hand or on the computer) and continue to modify them using processing. It can come in handy when wanting to decorate something rather than using processing to design everything (which would be far too troublesome).

For this task, we had to add a fourth planet to the three existing ones and cut out all the shape of the planets out of the background (helpful: Photoshop).

Other example of use: (in blog entry) "Finale: Breaking out of "Breakout"!"