Vector problem

From: Samba (sambachat_at_nshotmail.com)
Date: 12/30/03


Date: Tue, 30 Dec 2003 01:27:00 +0100

Hello, i got a problem dealing with a vector, i create a vector in which i
put tables of objects
(x, y et z) of "param" type (two attributes t and cst), i calculate the
values of this table in calculEquationDroite(...), but when i want to get
the values of t and cst of each x, y, z of my vector, i get an exception "in
thread main", and i don't understand why

Here is my code, if somenone understands my mistake, thanks:

//I add the x, y z
... equationsDroites.addElement(calculEquationDroite(c1[0], c1[1], c1[2],
c2[0],c2[1], c2[2]));
      equationsDroites.addElement(calculEquationDroite(c1[0], c1[1], c1[2],
c3[0],c3[1], c3[2]));
      equationsDroites.addElement(calculEquationDroite(c2[0], c2[1], c2[2],
c3[0],c3[1], c3[2]));

      //bug?
      for (int w = 0; w<equationsDroites.size(); w++){
        param[] r = (param[])equationsDroites.get(w);
        //System.out.println("Equation n° " + (w+1));
        System.out.println("x = " + r[0].t + " t" + "+ " + r[0].cst);
        System.out.println("y = " + r[1].t + " t" + "+ " + r[1].cst);
        System.out.println("z = " + r[2].t + " t" + "+ " + r[2].cst);
        }

//calculation of x, y, z
  public param[] calculEquationDroite(double x1, double y1, double z1,
double x2, double y2, double z2){
    // (x-x1)/(x2-x1) = (y-y1)/(y2-y1) = (z-z1)/(z2-z1)
    // Equation paramétrique de la droite entre les points p1 et p2
    // x = t(x2-x1) + x1
    // y = t(y2-y1) + y1
    // z = t(z2-z1) + z1
    //tableau de resultat
    param x = new param();
    param y = new param();
    param z = new param();
    param[] result = new param[3];
    x.t = x2-x1;
    x.cst = x1;
    y.t = y2-y1;
    y.cst = y1;
    z.t = z2-z1;
    z.cst = z1;
    result[0] = x;
    result[1] = y;
    result[2] = z;

    return result;
  }

class param{
  public double t;
  public double cst;

  param(){
    t = 0;
    cst = 0;
  }
}