Corrections et ajouts mineurs
point.hh : * Ajout de distance(float&, float&, float&). server.cc : * Modification et mise à jour de radar_exp(). * Correction de l'affichage des points sélectionnés dans getkClosestInSs(). * Correction du FBCM et d'Interlink (utilisation des distances au lieu des distances au carré, et utilisation de valeurs absolues). /!\ Reste à corriger frbhm_friis() ! git-svn-id: https://pif.pu-pm.univ-fcomte.fr/svn/loc@56 785a6c6c-259e-4ff1-8b91-dc31627914f0
This commit is contained in:
parent
7155a90a9d
commit
bec6fb2549
|
@ -27,6 +27,7 @@ public:
|
|||
float squareDistance(const Point &p)const { return ((x-p.x)*(x-p.x))+((y-p.y)*(y-p.y))+((z-p.z)*(z-p.z)); };
|
||||
float squareDistance(const float &mx, const float &my, const float &mz)const { return ((x-mx)*(x-mx))+((y-my)*(y-my))+((z-mz)*(z-mz)); };
|
||||
float distance(const Point &p)const { return sqrt(((x-p.x)*(x-p.x))+((y-p.y)*(y-p.y))+((z-p.z)*(z-p.z))); };
|
||||
float distance(const float &mx, const float &my, const float &mz)const { return sqrt(((x-mx)*(x-mx))+((y-my)*(y-my))+((z-mz)*(z-mz))); };
|
||||
|
||||
Point operator=(const Point &p) ;
|
||||
bool operator==(const Point &p) const {return ((x == p.x) && (y == p.y) && (z == p.z)) ;} ;
|
||||
|
|
|
@ -928,7 +928,7 @@ vector<Point> Server::getkClosestInSs(const vector<Measurement> &m, const unsign
|
|||
if (distances_vector.size() != points_vector.size())
|
||||
cout << "Erreur ! distances_vector.size()=" << distances_vector.size() << " != points_vector.size()=" << points_vector.size() << endl ;
|
||||
else
|
||||
for (i = 0 ; i < distances_vector.size() - 1 ; i++)
|
||||
for (i = 0 ; i < distances_vector.size() ; i++)
|
||||
cout << distances_vector[i] << " : " << points_vector[i] << endl ;
|
||||
#endif // DEBUG
|
||||
|
||||
|
@ -1095,8 +1095,8 @@ Point Server::fbcm(const vector<Measurement> &m, const int &client_idx)const
|
|||
{
|
||||
minmax_max = 0;
|
||||
for (i = 0 ; i < centres.size() ; i++)
|
||||
if ((centres[i].squareDistance(x, y, 3) - (dist_vect[i]*dist_vect[i])) > minmax_max)
|
||||
minmax_max = centres[i].squareDistance(x, y, 3) - (dist_vect[i] * dist_vect[i]);
|
||||
if (abs(centres[i].distance(x, y, 3) - dist_vect[i]) > minmax_max)
|
||||
minmax_max = abs(centres[i].distance(x, y, 3) - dist_vect[i]) ;
|
||||
if (minmax_max < minmax_res)
|
||||
{
|
||||
ret.setX(x);
|
||||
|
@ -1220,8 +1220,8 @@ Point Server::interlink(const vector<Measurement> &m, const int &client_idx)cons
|
|||
{
|
||||
minmax_max = 0;
|
||||
for (i = 0 ; i < centres.size() ; i++)
|
||||
if ((centres[i].squareDistance(x, y, 3) - (dist_vect[i] * dist_vect[i])) > minmax_max)
|
||||
minmax_max = centres[i].squareDistance(x, y, 3) - (dist_vect[i] * dist_vect[i]) ;
|
||||
if (abs(centres[i].distance(x, y, 3) - dist_vect[i]) > minmax_max)
|
||||
minmax_max = abs(centres[i].distance(x, y, 3) - dist_vect[i]) ;
|
||||
if (minmax_max < minmax_res)
|
||||
{
|
||||
ret.setX(x);
|
||||
|
@ -2400,12 +2400,19 @@ Point Server::fastViterbiLike(const unsigned int &client_id, const float_array &
|
|||
void Server::radar_exp()
|
||||
{
|
||||
ofstream logfile;
|
||||
vector<Point> solutions;
|
||||
Point solution, solution_kw, ref_coords;
|
||||
unsigned int i;
|
||||
vector<Measurement> vm;
|
||||
|
||||
// computeFriisFromRefList();
|
||||
computeFriisFromRefList() ;
|
||||
|
||||
if (client_list.empty())
|
||||
{
|
||||
#ifdef DEBUG
|
||||
cout << "radar_exp() : création d'un client." << endl ;
|
||||
#endif // DEBUG
|
||||
createClient() ;
|
||||
}
|
||||
|
||||
/* Open a log file */
|
||||
logfile.open(DEFAULT_LOGFILE);
|
||||
|
@ -2416,42 +2423,52 @@ void Server::radar_exp()
|
|||
}
|
||||
|
||||
/* Column names */
|
||||
logfile << "Coordinates\t2-kss\t(Error)\t3-kss\t(Error)\t4-kss\t(Error)\t5-kss\t(Error)\tnss\t(Error)\tInterlink\t(Error)\tFBCM\t(Error)" << endl;
|
||||
logfile << "Coordinates\
|
||||
\tInterlink\t(Error)\
|
||||
\tRADAR\t(Error)\
|
||||
\tFBCM\t(Error)\
|
||||
\t2 NSS\t(Error)\
|
||||
\t3 NSS\t(Error)\
|
||||
\t5 NSS\t(Error)\
|
||||
" << endl ;
|
||||
|
||||
cout << reference_point_list.size() << " reference points." << endl ;
|
||||
for (i = 0 ; i < reference_point_list.size() ; i++)
|
||||
{
|
||||
/* Get point measurements */
|
||||
vm.clear();
|
||||
vm = reference_point_list[i].getMeasurementList();
|
||||
ref_coords = reference_point_list[i].getCoordinates();
|
||||
|
||||
/* Print point coordinates */
|
||||
logfile << ref_coords << "\t";
|
||||
|
||||
/* From 2 to 5 K-weighted-SS */
|
||||
/* Interlink Networks */
|
||||
solution = interlink(vm, 0) ;
|
||||
logfile << solution << "\t" << solution.distance(ref_coords) << "\t" ;
|
||||
|
||||
/* RADAR */
|
||||
solution = getkClosestInSs(vm, 1, &ref_coords)[0] ;
|
||||
logfile << solution << "\t" << solution.distance(ref_coords) << "\t" ;
|
||||
|
||||
/* FBCM */
|
||||
solution = fbcm(vm, 0) ;
|
||||
logfile << solution << "\t" << solution.distance(ref_coords) << "\t" ;
|
||||
|
||||
/* K-weighted-SS, K = 2 */
|
||||
solution = getkWeightedInSs(vm, 2, &ref_coords);
|
||||
logfile << solution << "\t" << solution.distance(ref_coords) << "\t";
|
||||
|
||||
/* K-weighted-SS, K = 3 */
|
||||
solution = getkWeightedInSs(vm, 3, &ref_coords);
|
||||
logfile << solution << "\t" << solution.distance(ref_coords) << "\t";
|
||||
solution = getkWeightedInSs(vm, 4, &ref_coords);
|
||||
logfile << solution << "\t" << solution.distance(ref_coords) << "\t";
|
||||
|
||||
/* K-weighted-SS, K = 5 */
|
||||
solution = getkWeightedInSs(vm, 5, &ref_coords);
|
||||
logfile << solution << "\t" << solution.distance(ref_coords) << "\t";
|
||||
|
||||
/* Nearest in SS */
|
||||
solutions = getkClosestInSs(vm, 1, &ref_coords);
|
||||
logfile << solutions[0] << "\t" << solutions[0].distance(ref_coords) << "\t";
|
||||
|
||||
/* Interlink Networks */
|
||||
solution = interlink(vm, 0);
|
||||
logfile << solution << "\t" << solution.distance(ref_coords) << "\t";
|
||||
|
||||
/* FBCM */
|
||||
solution = fbcm(vm, 0);
|
||||
logfile << solution << "\t" << solution.distance(ref_coords) << endl;
|
||||
|
||||
solutions.clear();
|
||||
logfile << endl ;
|
||||
vm.clear() ;
|
||||
}
|
||||
|
||||
logfile.close();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue