
package tmcm.xModels;

import java.awt.Color;
import java.util.Vector;



class ExtrudeObject extends SceneMaker {

   ParamVal[] x,y;
   int repCount;
   
   ExtrudeObject(int reps, Vector params) {
      int points = params.size() / 2;
      repCount = reps;
      x = new ParamVal[points];
      y = new ParamVal[points];
      for (int i = 0; i < points; i++) {
         x[i] = (ParamVal)params.elementAt(2*i);
         y[i] = (ParamVal)params.elementAt(2*i+1);
      }
   }

   void prepare(PreparedScene scene, int frameNum, Transform T) {
      double[] a = new double[x.length];
      double[] b = new double[x.length];
      double zmin = - (repCount - 1.0) / 2.0;
      double zmax = (repCount - 1.0) / 2.0;
      for (int i = 0; i < x.length; i++) {
         a[i] = x[i].getVal(frameNum);
         b[i] = y[i].getVal(frameNum);
         scene.addLine(T,a[i],b[i],zmin,a[i],b[i],zmax);
      }
      double z = zmin;
      for (int rep = 0; rep < repCount; rep++) {
         for (int i = 0; i < x.length-1; i++)
            scene.addLine(T,a[i],b[i],z,a[i+1],b[i+1],z);
         z += 1;
      }
   }
   
}  // end class ExtrudeObject


