topical media & game development

talk show tell print

graphic-processing-algorithm-Appendix-p312-2-p312-2.pde / pde



  float [] px = new float[0];
  float [] py = new float[0];
  void setup(){
    size(100,100);
  }
  void draw(){
    background(255);
    stroke(0,255,0);
    beginShape();
    for(int i=1; i<px.length; i++)
      for(int j=0; j<px.length-1; j++){
        vertex(px[i],py[i]);
        vertex(px[j],py[j]);
      }
    endShape();
    stroke(0);
    for(int i=0; i<px.length; i++)
      rect(px[i],py[i],3,3);
  }
  void mousePressed(){
    rect(mouseX,mouseY, 3,3);
    px = append(px,mouseX);
    py = append(py,mouseY);
  }
  


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.