Triche dans min-max, Z dans interlink

server.hh:
- modified MINMAX_X/Y_MIN/MAX to fit Numerica size.
server.cc:
- added z-coordinate to trilat. algorithm in function "interlink".

git-svn-id: https://pif.pu-pm.univ-fcomte.fr/svn/loc@65 785a6c6c-259e-4ff1-8b91-dc31627914f0
This commit is contained in:
Frédéric Lassabe 2008-07-22 13:17:53 +00:00 committed by Matteo Cypriani
parent abc567980d
commit 2236f24c55
2 changed files with 19 additions and 17 deletions

View File

@ -1203,7 +1203,7 @@ Point Server::interlink(const vector<Measurement> &m, const int &client_idx)cons
vector<Point> 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;
for (i = 0 ; i < m.size() ; i++)
@ -1222,18 +1222,20 @@ Point Server::interlink(const vector<Measurement> &m, const int &client_idx)cons
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_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();

View File

@ -40,11 +40,11 @@ typedef ClientInfo::float_index float_index ;
#define DEFAULT_LISTEN_PORT 7777
#define LIGHT_SPEED 300000000
#define MINMAX_STEP 0.5
#define MINMAX_X_START -1
#define MINMAX_Y_START -1
#define MINMAX_X_START 0.5
#define MINMAX_Y_START 0.5
#define MINMAX_Z_START 0
#define MINMAX_X_STOP 15
#define MINMAX_Y_STOP 45
#define MINMAX_X_STOP 10
#define MINMAX_Y_STOP 31.5
#define MINMAX_Z_STOP 6
#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).