From 0df054ba48c932b9e753dbc5c75978a5a36bbc60 Mon Sep 17 00:00:00 2001 From: lecoanet Date: Tue, 7 Mar 2000 14:56:40 +0000 Subject: * Utilisation de ZnMalloc et consorts. * Sortie des functions de conversion d'angles vers Geo.h. --- generic/OverlapMan.c | 76 +++++++++------------------------------------------- 1 file changed, 12 insertions(+), 64 deletions(-) (limited to 'generic') diff --git a/generic/OverlapMan.c b/generic/OverlapMan.c index e986efa..4f062fb 100644 --- a/generic/OverlapMan.c +++ b/generic/OverlapMan.c @@ -40,6 +40,8 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ " #include "OverlapMan.h" +#include "Types.h" +#include "Geo.h" #include #include @@ -147,27 +149,6 @@ static double placing_step = M_PI/6.0; /* **************************************************************************** * - * Mrealloc -- - * Dynamic allocation/reallocation of 'size' bytes - * - **************************************************************************** - */ -static void * -Mrealloc(void *p, - unsigned int size) -{ - if (p != NULL) { - return realloc(p, size); - } - else { - return malloc(size); - } -} - - -/* - **************************************************************************** - * * FindPosW -- * Find the zinc position in the database, * if not found, gets the positon to insert in. @@ -230,7 +211,7 @@ AllocW(void *w, if (NBzincs == NBalloc_zincs) { NBalloc_zincs += NB_ALLOC; - wr = (ZINCS *) Mrealloc((void *) wr, sizeof(ZINCS) * NBalloc_zincs); + wr = (ZINCS *) ZnRealloc((void *) wr, sizeof(ZINCS) * NBalloc_zincs); } for (i = NBzincs-1; i >= pos; i--) { @@ -283,39 +264,6 @@ ProjToAngle(int dx, /* - ****************************************************************************** - * - * RadiansToDegrees -- - * Transform an angle from radian to degrees in the range [0, 359]. - * - ****************************************************************************** - */ -static int -RadiansToDegrees(double x) -{ - int i; - - i = (int) (x * 180.0 / M_PI); - return (i % 360 + 360) % 360; -} - - -/* - ****************************************************************************** - * - * DegreesToRadians -- - * Transform an angle from degrees in the range [0, 359] to radians. - * - ****************************************************************************** - */ -static double -DegreesToRadians(int x) -{ - return ((double) x) * M_PI / 180.0; -} - - -/* **************************************************************************** * * OmRegister -- @@ -357,7 +305,7 @@ OmUnregister(void *w) int i; if (FindPosW(w, &i) == TRUE) { - free(wr[i].infos); + ZnFree(wr[i].infos); memcpy((char *) &wr[i], (char *) &wr[i+1], (NBzincs-i-1)*sizeof(ZINCS)); NBzincs--; } @@ -472,8 +420,8 @@ PutTrackLoaded(int iw) */ if (wr[iw].NBinfos == wr[iw].NBalloc_infos) { wr[iw].NBalloc_infos += NB_ALLOC; - wr[iw].infos = (INFOS *) Mrealloc((void *) wr[iw].infos, - sizeof(INFOS)*wr[iw].NBalloc_infos); + wr[iw].infos = (INFOS *) ZnRealloc((void *) wr[iw].infos, + sizeof(INFOS)*wr[iw].NBalloc_infos); } if (pos < wr[iw].NBinfos) { @@ -529,7 +477,7 @@ ReadTracks(int iw) &info1.rho, &info1.theta, &info1.visibility))) { info1.alpha = (ProjToAngle(info1.vv_dx, info1.vv_dy ) - M_PI_2 + - DegreesToRadians(info1.theta)); + DegreesToRadian(info1.theta)); info1.dx = (int) info1.rho * cos(info1.alpha); info1.dy = (int) info1.rho * sin(info1.alpha); info1.Refresh = TRUE; @@ -982,11 +930,11 @@ OmProcessOverlap(void *zinc, } wr[iw].infos[ip].alpha += wr[iw].infos[ip].alpha_point * DELTA_T ; - wr[iw].infos[ip].theta = RadiansToDegrees(wr[iw].infos[ip].alpha - - ProjToAngle(wr[iw].infos[ip].vv_dx, - wr[iw].infos[ip].vv_dy) - + M_PI_2); - + wr[iw].infos[ip].theta = (int) RadianToDegrees360(wr[iw].infos[ip].alpha - + ProjToAngle(wr[iw].infos[ip].vv_dx, + wr[iw].infos[ip].vv_dy) + + M_PI_2); + /* if (wr[iw].infos[ip].theta > 75 && wr[iw].infos[ip].theta < 105) { if (wr[iw].infos[ip].alpha_point > 0) { -- cgit v1.1