All posts by Albert Zündorf

Programming Methodologies, WS1415

Liebe Teilnehmer,

wie bereits in der E-Mail angekündigt, fällt die Programmiermethodik Übung am 30.01. aus.
Im HMS wird eine neue, zusammenfassende Hausaufgabe gestellt, deren Bearbeitungszeit bis zum 12.02. angesetzt ist. Da der Umfang für eine Woche geplant ist, könnte die Hausaufgabe erst eine Woche später gestellt werden, wir wollen allerdings ungern in Verzug kommen. Es sind keine neuen Inhalte notwendig, daher wird es einen kurzen Screencast geben, in welchem die Aufgabenstellung erläutert wird. Pattern Objects brauchen in dieser Hausaufgabe ebenfalls nicht verwendet werden.
Bei Fragen sind wir per Mail an pm@cs.uni-kassel.de erreichbar, Mittwoch, den 04.02. zwischen 13-15 Uhr bieten wir wie gewohnt die Sprechstunde/Zweitübung an und die Übung am 06.02. findet ebenfalls statt.

Viele Grüße,
das SE-Team

Einführung in die Programmierung, WS1415

Sorry, recording the screen cast did not work.

Instead find the source code of the FractalTree from the lecture here:

package de.uks.ep1415.m1234567.ha11;

import processing.core.PApplet;

public class FractalTree extends PApplet
{
   @Override
   public void setup()
   {
      size(400, 600);
   }
   
   float totalSize = 5;
   
   @Override
   public void draw()
   {
      background(255);
      
      drawTree(200, 550, PI/2, totalSize);
      
      totalSize++;
   }

   private void drawTree(float rootX, float rootY, float angle, float size)
   {
      float topX = rootX + size * cos(angle);
      float topY = rootY - size * sin(angle);
      
      stroke(139,69,19);
      strokeWeight(size / 20);
      line(rootX, rootY, topX, topY);
      
      noStroke();
      fill(0, 255, 0);
      ellipse(topX, topY, 10, 10);
      
      if (size >= 10)
      {
         drawTree((topX+rootX)/2, (topY+rootY)/2, angle-PI/4, size*0.7f);
         drawTree((topX+rootX)/2, (topY+rootY)/2, angle+PI/4, size*0.6f);
      }
   
   }
}