Bonjour,
j'utilise la classe vector pour creer un tableau.
je l'utilise comme ceci:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
 
	double * pt=dataPiece.getPoint(0);
	std::vector<double> height(dataPiece.getNumberOfPoints());
	cout<<"data number of points: "<<dataPiece.getNumberOfPoints()<<endl;
 
	for(int i=0; i<dataPiece.getNumberOfPoints(); i++ ){
		pt=dataPiece.getPoint(i);
		cout<<"pt[2]: "<<pt[2]<<endl;
		height.push_back(pt[2]);
		cout<<"height["<<i<<"]: "<<height[i]<<endl;
	}
A l'affichage, la valeur de pt[2] donne des valeurs du style de: 7.0563 ou -0.45.
Par contre height[i] affiche toujours 0.
J'ai donc essaye ceci:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
 
	double * pt=dataPiece.getPoint(0);
	std::vector<double> height(dataPiece.getNumberOfPoints());
	std::vector<double>::iterator it=height.begin();
	cout<<"data number of points: "<<dataPiece.getNumberOfPoints()<<endl;
 
	for(int i=0; i<dataPiece.getNumberOfPoints(); i++ ){
		pt=dataPiece.getPoint(i);
		cout<<"pt[2]: "<<pt[2]<<endl;
		height.push_back(pt[2]);
		cout<<"height["<<i<<"]: "<<*it<<endl;
		it++;
	}
mais le resultat est sensiblement le meme. Au lieu d'avoir 0, j'ai toujours -2.65698e+303.
pourquoi?

J'attends vos reponses avec impatiente.
Merci d'avance.