Sechs Kursabende à vier Stunden an der EB Zürich
Kurskonzeption und Leitung Hanna Züllig
/* Autor: Rolf Stutz Kurs: Einblick in die generative Gestaltung mit processing ip971311 Kursleitung: Hanna Zuellig Veroeffentlicht unter der creative common license Attribution-NonCommercial-ShareAlike CC BY-NC-SA http://creativecommons.org/licenses/ */ int color1 = 255; int color2 = 0; void setup() { size(500,500); background(color1); stroke(color2); smooth(); } void draw() { if (mousePressed) { color1 = 0; color2 = 255; } else { color1 = 255; color2 = 0; } background(color1); stroke(color2); drawCercleAndQuad(0, 0, 500); drawCercleAndQuad(0, 0, 250); drawCercleAndQuad(0, 250, 250); drawCercleAndQuad(250, 0, 250); drawCercleAndQuad(250, 250, 250); } void drawCercleAndQuad(int x, int y, int len) { int l2 = len / 2; int widthEllipse = len / 5 * 4; fill(color2); ellipse(x + l2, y + l2, widthEllipse, widthEllipse); fill(color1); quad(x + l2, y, x + len, y + l2, x + l2, y + len, x, y + l2); } boolean isPointInPolygon(int x[], int y[], int px, int py) { int N = x.length; if (N < 3) { return false; } boolean odd = false; int x2 = x[N - 1]; int y2 = y[N - 1]; int x1, y1; for (int i = 0; i < N; x2 = x1, y2 = y1, ++i) { x1 = x[i]; y1 = y[i]; if (((y1 < py) && (y2 >= py)) || (y1 >= py) && (y2 < py)) { if ((py - y1) / (y2 - y1) * (x2 - x1) < (px - x1)) { odd = !odd; } } } return odd; } void createImages() { drawCercleAndQuad(0, 0, 500); drawCercleAndQuad(0, 0, 250); saveFrame("bild-11A.png"); drawCercleAndQuad(0, 250, 250); drawCercleAndQuad(250, 0, 250); drawCercleAndQuad(250, 250, 250); // saveFrame("bild-11B.png"); } void drawCat() { stroke(255); fill(0); triangle(0,0,50,50,0,100); triangle(50,50,100,0,100,100); quad(0,100,50,50,100,100,50,150); triangle(100,100,30,170,100,240); } void drawTangramOne() { stroke(255); line(0,0,375,375); line(500,0,0,500); line(500,250,250,500); line(125,375,250,500); line(375,125,375,375); }