diff --git a/GuiNuMo-server/server.cc b/GuiNuMo-server/server.cc index 2e0f42b..18faa3c 100644 --- a/GuiNuMo-server/server.cc +++ b/GuiNuMo-server/server.cc @@ -1068,7 +1068,7 @@ Point Server::fbcm(const vector &m, const int &client_idx)const vector centres; unsigned int i, ap_idx; float constant_term, minmax_res, minmax_max; - float x = MINMAX_X_START, y = MINMAX_Y_START; + float x = MINMAX_X_START, y = MINMAX_Y_START, z = MINMAX_Z_START; i = 0; //cout << "FBCM: "; @@ -1092,19 +1092,21 @@ Point Server::fbcm(const vector &m, const int &client_idx)const minmax_res = 1000000; for (x = MINMAX_X_START ; x < MINMAX_X_STOP ; x += MINMAX_STEP) for (y = MINMAX_Y_START ; y < MINMAX_Y_STOP ; y += MINMAX_STEP) - { - minmax_max = 0; - for (i = 0 ; i < centres.size() ; 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); - ret.setY(y); - minmax_res = minmax_max; - } - } - + for(z = MINMAX_Z_START ; z <= MINMAX_Z_STOP ; z += MINMAX_Z_STEP) + { + minmax_max = 0; + for (i = 0 ; i < centres.size() ; i++) + if (abs(centres[i].distance(x, y, z) - dist_vect[i]) > minmax_max) + minmax_max = abs(centres[i].distance(x, y, z) - dist_vect[i]) ; + if (minmax_max < minmax_res) + { + ret.setX(x); + ret.setY(y); + ret.setZ(z); + minmax_res = minmax_max; + } + } + /* Clear all vectors */ addr.clear(); dist_vect.clear(); @@ -1131,7 +1133,7 @@ Point Server::fbcm_friis( const vector &m, const vector frii vector centres; unsigned int i, j, ap_idx; float constant_term, minmax_res, minmax_max; - float x = MINMAX_X_START, y = MINMAX_Y_START; + float x = MINMAX_X_START, y = MINMAX_Y_START, z = MINMAX_Z_START; i = 0; //cout << "FBCM: "; @@ -1152,24 +1154,23 @@ Point Server::fbcm_friis( const vector &m, const vector frii } /* Then: min-max */ - minmax_res = 1000000; + minmax_res = 1000000; for (x = MINMAX_X_START ; x < MINMAX_X_STOP ; x += MINMAX_STEP) for (y = MINMAX_Y_START ; y < MINMAX_Y_STOP ; y += MINMAX_STEP) - { - minmax_max = 0; - for (i = 0 ; i < centres.size() ; i++) - if ((std::abs(centres[i].distance(Point(x, y, 3)) - dist_vect[i])) > minmax_max) - { - minmax_max = std::abs(centres[i].distance(Point(x, y, 3)) - dist_vect[i]); - //cout << "minmax_max: " << minmax_max << endl; - } - if (minmax_max < minmax_res) - { - ret.setX(x); - ret.setY(y); - minmax_res = minmax_max; - } - } + for(z = MINMAX_Z_START ; z <= MINMAX_Z_STOP ; z += MINMAX_Z_STEP) + { + minmax_max = 0; + for (i = 0 ; i < centres.size() ; i++) + if (abs(centres[i].distance(x, y, z) - dist_vect[i]) > minmax_max) + minmax_max = abs(centres[i].distance(x, y, z) - dist_vect[i]) ; + if (minmax_max < minmax_res) + { + ret.setX(x); + ret.setY(y); + ret.setZ(z); + minmax_res = minmax_max; + } + } /* Clear all vectors */ addr.clear(); diff --git a/GuiNuMo-server/server.hh b/GuiNuMo-server/server.hh index b1beaea..9fd4cff 100644 --- a/GuiNuMo-server/server.hh +++ b/GuiNuMo-server/server.hh @@ -40,10 +40,13 @@ typedef ClientInfo::float_index float_index ; #define DEFAULT_LISTEN_PORT 7777 #define LIGHT_SPEED 300000000 #define MINMAX_STEP 0.5 +#define MINMAX_Z_STEP 3 #define MINMAX_X_START -1 #define MINMAX_Y_START -1 +#define MINMAX_Z_START 0 #define MINMAX_X_STOP 15 #define MINMAX_Y_STOP 45 +#define MINMAX_Z_STOP 3 #define BUFFER_LENGTH 5000 //#define DEFAULT_Z 3 // Décommenter pour utiliser des fichiers d'entrée avec des coordonnées dans un seul plan (X, Y). //#define FRED_CSV_FORMAT // Décommenter pour utiliser les fichiers CSV au « format Fred » (plusieurs lignes par mesure, avec un AP par ligne).