topical media & game development

talk show tell print

graphic-processing-algorithm-Ch09-p221-p221.pde / pde



  MyPoint [] points;
  MySolid solid;
  MyPoint origin = new MyPoint(0,0,0);
  void setup(){
    size(200, 200, P3D);
    noFill();
    camera(70.0, 35.0, 120.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
    points = new MyPoint[4];
    points[0] = new MyPoint( 50, 50, 0);
    points[1] = new MyPoint(-50, 50, 0);
    points[2] = new MyPoint(-50, -50, 0);
    points[3] = new MyPoint( 50, -50, 0);
    solid = new MySolid(points, 20.);
  }
  int xf, yf;
  void draw(){
    background(255);
    solid.rotatex((mouseX - xf) * PI/180.,origin);
    solid.rotatey((mouseY - yf) * PI/180.,origin);
    solid.draw();
    xf = mouseX;
    yf = 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.