Fixes the new dist_max search
Last (at least, we hope) mod. of getkClosestInSs function. git-svn-id: https://pif.pu-pm.univ-fcomte.fr/svn/loc@33 785a6c6c-259e-4ff1-8b91-dc31627914f0
This commit is contained in:
parent
b2f613bce5
commit
cbe71f0004
|
@ -388,16 +388,15 @@ vector<Point> Server::getkClosestInSs(const vector<Measurement> &m, const unsign
|
||||||
for (j = 0 ; j < distances_vector.size() ; j++)
|
for (j = 0 ; j < distances_vector.size() ; j++)
|
||||||
if (distances_vector[j] == dist_max)
|
if (distances_vector[j] == dist_max)
|
||||||
{
|
{
|
||||||
dist_max = tmp_distance;
|
|
||||||
/* Old fashion
|
|
||||||
distances_vector.erase(distances_vector.begin() + j);
|
|
||||||
points_vector.erase(points_vector.begin() + j);
|
|
||||||
distances_vector.push_back(tmp_distance);
|
|
||||||
points_vector.push_back(reference_point_list[i].getCoordinates());*/
|
|
||||||
distance_vector[j] = tmp_distance;
|
distance_vector[j] = tmp_distance;
|
||||||
points_vector[j] = reference_point_list[i].getCoordinates();
|
points_vector[j] = reference_point_list[i].getCoordinates();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
/* Now seek the new max. distance */
|
||||||
|
dist_max = distances_vector[0];
|
||||||
|
for(j = 1 ; j < distances_vector.size() ; j++)
|
||||||
|
if(distances_vector[j] > dist_max)
|
||||||
|
dist_max = distances_vector[j];
|
||||||
}
|
}
|
||||||
/* Else nothing needs to be done */
|
/* Else nothing needs to be done */
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue