public static double[] creeVec(double x, double y, double z){
//cree et retourne un tableau
double[] tab = new double[3];
tab[0]=x;
tab[1]=y;
tab[2]=z;
return tab;
}
public static double longueur(double[] tab){
//calcule la longueur
tab = new double[3];
double carre = ((tab[0]*tab[0])+(tab[1]*tab[1])+(tab[2]*tab[2]));
return Math.sqrt(carre);
}
And then when I called them to get my result of Math.sqrt()
I get 0
double[] v1 = Vec3DTab.creeVec(10, 20, 30);
double[] v2 = Vec3DTab.creeVec(4, 5, 6);
//affiche la longueur de v1
double LongueurV1 = Vec3DTab.longueur(v1);
System.out.println(LongueurV1);
Doing:
is bad form, do:
but it seems like you are going to a lot of rigmarole to get
but your real problem is here: