PImage img;

  Boolean rot=false;
  float rotAciX=0;
  float rotAciY=0;
  float rotAciZ=0;

int[][] imgPixels;
float sval = 1.0;
float nmx, nmy;
int res = 2;

void setup() {

  size(660,660,P3D);
  background(0);
  smooth();
  rectMode(CENTER);

  noStroke();
  colorMode(HSB, 100);

  int i;
  int j;

  //pattern olusturma

  beginShape(LINES);
  for (int k = 60; k <= 540; k = k+40) {
    for (int l = 60; l <= 540; l = l+40) {

        j = ((((k)*(l))/(60*60*(45/10)))-1);

        stroke((k/(5)),(l/(5)), 100);
        strokeWeight(2);

        line ((k+30),(l+(24-(3*j))),0,(k+(31+j)),(l+(29-j)),0);
        line ((k+(31+j)),(l+(29-j)),0,(k+(36+(3*j))),(l+30),0);
        line ((k+(36+(3*j))),(l+30),0,(k+(31+j)),(l+(31+j)),0);
        line ((k+(31+j)),(l+(31+j)),0,(k+30),(l+(36+(3*j))),0);
        line ((k+30),(l+(36+(3*j))),0,(k+(29-j)),(l+(31+j)),0);
        line ((k+(29-j)),(l+(31+j)),0,(k+(24-(3*j))),(l+30),0);
        line ((k+(24-(3*j))),(l+30),0,(k+(29-j)),(l+(29-j)),0);
        line ((k+(29-j)),(l+(29-j)),0,(k+30),(l+(24-(3*j))),0);

        }
      }

  endShape();

        save ("data/pattern_output.png");
        img = loadImage("pattern_output.png");
        imgPixels = new int[img.width][img.height];

        for (int m1 = 0; m1 < img.width; m1++) {
          for (int n1 = 0; n1 < img.height; n1++) {

        imgPixels[n1][m1] = img.get((n1),(m1));

          }
        }
      noSmooth();
}

void draw() {

    background(0);

      nmx = nmx + (mouseX-nmx)/20;
      nmy += (mouseY-nmy)/20;

                if (keyPressed && (key == 'i')) {
      sval += 0.05;
    }
                else if (keyPressed && (key == 'o')) {
      sval -= 0.05;
    }

    sval = constrain(sval, 1.0, 2.5);

    translate(width/2 + nmx * sval-100, height/2 + nmy*sval - 200, -50);
    scale(sval);

    rotateX(rotAciX);
    rotateY(rotAciY);
    rotateZ(rotAciZ);

  for (int i = 0; i < img.width; i += res) {
    for (int j = 0; j < img.height; j += res) {

      float rr = red(imgPixels[j][i]);
      float gg = green(imgPixels[j][i]);
      float bb = blue(imgPixels[j][i]);
      float tt = ((rr+gg+bb)*(sin(radians((i/10.0)+(j/5.0)+(frameCount%360)))));
      if(tt==0)
        continue;

      stroke(rr, gg, bb);
      line(i,j,0,i,j,(tt));
    }
  }

}

  void mouseDragged() {

  rot=true;
  rotAciY=radians(pmouseX%360);
  rotAciX=radians(pmouseY%360);

  }

  void keyPressed() {

  if(key == '1') {
    res = 1;
  }
  else if (key == '2') {
    res = 2;
  }
  else if (key == '3') {
    res = 3;
  }
  else if (key == '4') {
    res = 4;
  }
  else if (key == '5') {
    res = 5;
  }

}

Bu ilk uygulamanın kaynak kodunu oluşturmakta. Aslına bakarsanız Processing “example” klasörü içerisinde yer alan “explode” ve “extrusion” örneklerinden esinlemeler mevcut. İkinci kaynak kodu da şu şekilde;


PImage img;

  Boolean rot=false;
  float rotAciX=0;
  float rotAciY=0;
  float rotAciZ=0;

int[][] imgPixels;
float sval = 1.0;
float nmx, nmy;
int res = 2;

/*
 * Bu class 2D koordinatlari tutar
 */
class Point {
  private float x; // dikkat artik private
  private float y;

  // Bu class'in constructor'i
  Point (float x, float y) {
    this.x = x;
    this.y = y;
  }

  // Benimle verilen p noktasi arasindaki mesafeyi hesaplar
  public float getDistance(Point p) {
    return sqrt( pow(x - p.getx(), 2) + pow(y - p.gety(), 2) );
  }

  // Benimle verilen p noktasi arasindaki egimi hesaplar
  public float getSlope(Point p) {
    return (p.gety() - y) / (p.getx() - x);
  }

  // Artik private tanimladigim icin bu fonksiyonlar lazim.
  public void setx (float x) {
    this.x = x;
  }

  public void sety (float y) {
    this.y = y;
  }

  public float getx () {
    return x;
  }

  public float gety () {
    return y;
  }

}

class Multiangle {
  private Point[] elements; // Sekli olusturan noktalar
  private float radius; // Seklin icine oturdugu daire
  private Point center; // Bu dairenin merkezinin koordinati

  //  Constructor
  //  int s - Kenar sayisi
  //  float radius - icine oturdugu dairenin yari capi
  //  Point center - dairenin merkezinin koordinatlari
  Multiangle (int s, float radius, Point center) {
    this.radius = radius;
    this.center = center;
    this.elements = new Point[s];
    float angle = TWO_PI/s;
    for (int f = 0; f < s; f++) {
      elements[f] = new Point(center.getx() + sin(angle * f) * radius,
                             center.gety() + cos(angle * f) * radius);
    }
  }

  // Constructor
  // int s - Kenar sayisi
  // float radius - icine oturdugu dairenin yari capi
  Multiangle (int s, float radius) {
    this.elements = new Point[s];
    this.radius = radius;
  }

  /*
   * Bu seklin ekranda gosterilmesini saglar
   */
  public void display () {
    beginShape();  // boyle faydali bir komut vardi...
    for (int f = 0; f < elements.length; f++) {
      Point p = elements[f];
      vertex (p.getx(), p.gety());
    }
    endShape(CLOSE);
  }

  public Point[] getElements() {
    return elements;
  }

  public float getRadius() {
    return radius;
  }
}

void setup() {
  size(660,660,P3D);
  background(0);
  smooth();
  rectMode(CENTER);

  noStroke();
  colorMode(HSB, 100);

  for (int k = 60; k <= 540; k = k+40) {
    for (int l = 60; l <= 540; l = l+40) {

        stroke((k/(5)),(l/(5)), 100);
        strokeWeight(2);
        fill (0,0,0);

        Multiangle a = new Multiangle (5, 40, new Point(k, l));
        a.display();

    }
  }

          save ("data/pattern_output.png");
        img = loadImage("pattern_output.png");
        imgPixels = new int[img.width][img.height];

        for (int m1 = 0; m1 < img.width; m1++) {
          for (int n1 = 0; n1 < img.height; n1++) {

        imgPixels[n1][m1] = img.get((n1),(m1));

          }
        }
      noSmooth();

}

void draw() {

    background(0);

      nmx = nmx + (mouseX-nmx)/20;
      nmy += (mouseY-nmy)/20;

                if (keyPressed && (key == 'i')) {
      sval += 0.05;
    }
                else if (keyPressed && (key == 'o')) {
      sval -= 0.05;
    }

    sval = constrain(sval, 1.0, 2.5);

    translate(width/2 + nmx * sval-100, height/2 + nmy*sval - 200, -50);
    scale(sval);

    rotateX(rotAciX);
    rotateY(rotAciY);
    rotateZ(rotAciZ);

  for (int i = 0; i < img.width; i += res) {
    for (int j = 0; j < img.height; j += res) {

      float rr = red(imgPixels[j][i]);
      float gg = green(imgPixels[j][i]);
      float bb = blue(imgPixels[j][i]);
      float tt = ((rr+gg+bb)*(sin(radians((i/10.0)+(j/5.0)+(frameCount%360)))));
      if(tt==0)
        continue;

      stroke(rr, gg, bb);
      line(i,j,0,i,j,(tt));
    }
  }

}

  void mouseDragged() {

  rot=true;
  rotAciY=radians(pmouseX%360);
  rotAciX=radians(pmouseY%360);

  }

  void keyPressed() {

  if(key == '1') {
    res = 1;
  }
  else if (key == '2') {
    res = 2;
  }
  else if (key == '3') {
    res = 3;
  }
  else if (key == '4') {
    res = 4;
  }
  else if (key == '5') {
    res = 5;
  }

}

Ayrıca Processing uygulamaları DropBox içerisinde, “dogan” klasöründe de mevcut.

Doğan Türkkan