mercredi 5 juillet 2017

only 1 element per vector in c++

I have vector< vector<Point3f> > clusters;
Now I want to save only first element per cluster in another vector. So I tried like below
for(int i = 1; i < clusters.size(); i++) clusters_point.push_back(clusters[i].at(0));
where vector<Point3f> clusters_point;
This works but I am getting those point multiple times as I am simple repeating the loop by using size of clusters. How can push only one point form each vector to another vector?

Aucun commentaire:

Enregistrer un commentaire