topical media & game development

talk show tell print

graphic-processing-algorithm-Ch09-p237-MyGroup.pde / pde



  
  class MyGroup  {
    MySolid [] solids;
    int nsolids;
  
    MyGroup (){
      solids = new MySolid[0];
    }
  /*
    MyGroup(MySolid[] inSolids){
      numSolids = inSolids.length;
      solids = new MySolid[numSolids];
      for(int i=0; i<numSolids; i++)
        solids[i] = new MySolid(inSolids[i].faces);  
  
    }
  */
    void addSolids(MyPoint[] points, float hite){
      nsolids++;
      solids = (MySolid[])append(solids, new MySolid(points,hite));
    }
  
    //******************
    void draw(){
      for(int i=0; i<nsolids; i++)
        solids[i].draw();
  
    }
  
    //*************
    void rotatex (float angle, MyPoint ref) {
      for(int i=0; i<nsolids; i++)
        solids[i].rotatex(angle, ref);
    }
  
    //*************
    void rotatey (float angle, MyPoint ref) {
      for(int i=0; i<nsolids; i++)
        solids[i].rotatey(angle, ref);
    }
  
    //*************
    void rotatez (float angle, MyPoint ref) {
      for(int i=0; i<nsolids; i++)
        solids[i].rotatez(angle, ref);
    }
  
    //*************
    void scale(float xs, float ys, float zs, MyPoint ref) {
      for(int i=0; i<nsolids; i++)
        solids[i].scale(xs, ys, zs, ref);
    }
  
    //*************
    void move(float xoff, float yoff, float zoff){
      for(int i=0; i<nsolids; i++)
        solids[i].move(xoff, yoff, zoff);
    }
  }
  


(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.