aboutsummaryrefslogtreecommitdiff
path: root/generic/OverlapMan.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/OverlapMan.c')
-rw-r--r--generic/OverlapMan.c538
1 files changed, 269 insertions, 269 deletions
diff --git a/generic/OverlapMan.c b/generic/OverlapMan.c
index e8515ff..72f4499 100644
--- a/generic/OverlapMan.c
+++ b/generic/OverlapMan.c
@@ -1,8 +1,8 @@
/*
* OverlapMan.c -- Track label overlap avoidance manager implementation.
*
- * Authors :
- * Creation date :
+ * Authors :
+ * Creation date :
*
* $Id$
*/
@@ -59,13 +59,13 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ "
#define signe(a) ((a) < (0) ? (-1) : (1))
#define abs(a) ((a) < (0) ? -(a) : (a))
#ifndef M_PI
-#define M_PI 3.14159265358979323846264338327
+#define M_PI 3.14159265358979323846264338327
#endif
#ifndef M_PI_2
-#define M_PI_2 1.57079632679489661923
+#define M_PI_2 1.57079632679489661923
#endif
#ifndef M_PI_4
-#define M_PI_4 0.78539816339744830962
+#define M_PI_4 0.78539816339744830962
#endif
#define DegreesToRadian(angle) \
(M_PI * (double) (angle) / 180.0)
@@ -79,9 +79,9 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ "
#define COEF1 0.5 /* coef of second repulsion point */
#define COEF2 0.1 /* coef of second repulsion point */
-#define DELTA_T 0.1 /* integration step for Euler method */
-#define FALSE 0
-#define TRUE 1
+#define DELTA_T 0.1 /* integration step for Euler method */
+#define FALSE 0
+#define TRUE 1
typedef int BOOLEAN;
@@ -108,12 +108,12 @@ typedef struct _INFOS {
} INFOS;
typedef struct _ZINCS {
- void *rw;
- void *(*_next_track)();
- void (*_set_label_angle)();
- INFOS *infos;
- int NBinfos;
- int NBalloc_infos;
+ void *rw;
+ void *(*_next_track)();
+ void (*_set_label_angle)();
+ INFOS *infos;
+ int NBinfos;
+ int NBalloc_infos;
} ZINCS;
/*
@@ -124,25 +124,25 @@ typedef struct _ZINCS {
/*
* real parameters adresse
*/
-static double K0 = 2100.0; /* Repulsion factor */
-static double K0min = 500.0;
-static double K0max = 3000.0;
+static double K0 = 2100.0; /* Repulsion factor */
+static double K0min = 500.0;
+static double K0max = 3000.0;
-static double n0 = 2.10; /* Repulsion exponent */
-static double n0min = 2.0;
-static double n0max = 3.0;
+static double n0 = 2.10; /* Repulsion exponent */
+static double n0min = 2.0;
+static double n0max = 3.0;
-static double K1 = 6.0; /* Friction factor */
-static double K1min = 1.0;
-static double K1max = 10.0;
+static double K1 = 6.0; /* Friction factor */
+static double K1min = 1.0;
+static double K1max = 10.0;
-static double K2 = 6.0; /* Drawback forces factor */
-static double K2min = 1.0;
-static double K2max = 10.0;
+static double K2 = 6.0; /* Drawback forces factor */
+static double K2min = 1.0;
+static double K2max = 10.0;
-static double K3 = 4.0; /* Keep in view forces factor */
-static double K3min = 1.0;
-static double K3max = 10.0;
+static double K3 = 4.0; /* Keep in view forces factor */
+static double K3min = 1.0;
+static double K3max = 10.0;
/*
* accessor structure need for generic set/get method
@@ -152,7 +152,7 @@ typedef struct _OMPARAM {
int size;
char *name;
void *data;
- BOOLEAN rw; /* 1 means readwrite, 0 means read only */
+ BOOLEAN rw; /* 1 means readwrite, 0 means read only */
} OMPARAM, *pOMPARAM;
/*
@@ -179,45 +179,45 @@ static OMPARAM OmParamAccess[] = {
};
static int NbParam = sizeof(OmParamAccess) / sizeof(OMPARAM) - 1;
-static ZINCS *wr = NULL;
-static int NBzincs=0;
-static int NBalloc_zincs=0;
-static INFOS info1;
+static ZINCS *wr = NULL;
+static int NBzincs=0;
+static int NBalloc_zincs=0;
+static INFOS info1;
/*
* Square of the distance (between two label centers) below which
* the repulsion is not computed.
*/
-static double limit_distance = 6.0;
+static double limit_distance = 6.0;
/*
* Square of the minimum distance (between two label centers)
* considered during initialisation of the leaders.
*/
-static double placing_min_dist = 11000.0;
+static double placing_min_dist = 11000.0;
/*
* Angle step between two placement trials.
*/
-static double placing_step = M_PI/6.0;
+static double placing_step = M_PI/6.0;
/*
****************************************************************************
*
* FindPosW --
- * Find the zinc position in the database,
+ * Find the zinc position in the database,
* if not found, gets the positon to insert in.
*
****************************************************************************
*/
static BOOLEAN
-FindPosW(void *w,
- int *mid)
+FindPosW(void *w,
+ int *mid)
{
- int left=0;
- int right=NBzincs-1;
+ int left=0;
+ int right=NBzincs-1;
if (w < wr[0].rw) {
*mid = 0;
@@ -256,15 +256,15 @@ FindPosW(void *w,
****************************************************************************
*
* AllocW --
- * Allocate cells in database for the specified zinc.
+ * Allocate cells in database for the specified zinc.
*
****************************************************************************
*/
static void
-AllocW(void *w,
- int pos)
+AllocW(void *w,
+ int pos)
{
- int i;
+ int i;
if (NBzincs == NBalloc_zincs) {
NBalloc_zincs += NB_ALLOC;
@@ -280,7 +280,7 @@ AllocW(void *w,
wr[pos].rw = w;
wr[pos].infos = NULL;
wr[pos].NBinfos = 0;
- wr[pos].NBalloc_infos = 0;
+ wr[pos].NBalloc_infos = 0;
}
@@ -288,13 +288,13 @@ AllocW(void *w,
***************************************************************************
*
* ProjToAngle --
- * Compute an angle from dx and dy projections.
+ * Compute an angle from dx and dy projections.
*
***************************************************************************
*/
static double
-ProjToAngle(int dx,
- int dy)
+ProjToAngle(int dx,
+ int dy)
{
if (dx == 0) {
if (dy < 0) {
@@ -302,10 +302,10 @@ ProjToAngle(int dx,
}
else {
if (dy > 0) {
- return M_PI_2;
+ return M_PI_2;
}
else {
- return 0;
+ return 0;
}
}
}
@@ -324,7 +324,7 @@ ProjToAngle(int dx,
****************************************************************************
*
* OmInit --
- * Called only once to initialize some internal data.
+ * Called only once to initialize some internal data.
*
****************************************************************************
*/
@@ -332,31 +332,31 @@ void
OmInit()
{
/* printf("OmInit\n");*/
-}
+}
/*
****************************************************************************
*
* OmRegister --
- * Create a database entry for the specified zinc.
+ * Create a database entry for the specified zinc.
*
****************************************************************************
*/
void
-OmRegister(void *w,
- void *(*_fnext_track)(void *, void *,
- int *, int *,
- int *, int *,
- int *, int *,
- int *, int *,
- int *, int *),
- void (*_fset_label_angle)(void *, void *, int, int),
- void (*_fquery_label_pos)(void *, void *, int,
- int *, int *, int *, int *))
+OmRegister(void *w,
+ void *(*_fnext_track)(void *, void *,
+ int *, int *,
+ int *, int *,
+ int *, int *,
+ int *, int *,
+ int *, int *),
+ void (*_fset_label_angle)(void *, void *, int, int),
+ void (*_fquery_label_pos)(void *, void *, int,
+ int *, int *, int *, int *))
{
- int iw=0;
- BOOLEAN found=FALSE;
+ int iw=0;
+ BOOLEAN found=FALSE;
if (NBzincs > 0) {
found = FindPosW(w, &iw);
@@ -373,14 +373,14 @@ OmRegister(void *w,
****************************************************************************
*
* OmUnregister --
- * Cancel database information about the specified zinc.
+ * Cancel database information about the specified zinc.
*
****************************************************************************
*/
void
-OmUnregister(void *w)
+OmUnregister(void *w)
{
- int i;
+ int i;
if (FindPosW(w, &i) == TRUE) {
free(wr[i].infos);
@@ -394,18 +394,18 @@ OmUnregister(void *w)
***************************************************************************
*
* FindPosId --
- * Find track position in the database,
+ * Find track position in the database,
* if not found gets the positon to insert in.
*
***************************************************************************
*/
static BOOLEAN
-FindPosId(int iw,
- void *id,
- int *mid)
+FindPosId(int iw,
+ void *id,
+ int *mid)
{
- int left=0;
- int right= wr[iw].NBinfos-1;
+ int left=0;
+ int right= wr[iw].NBinfos-1;
if (id < wr[iw].infos[0].id) {
*mid = 0;
@@ -444,7 +444,7 @@ FindPosId(int iw,
***************************************************************************
*
* SetTrackInitValues --
- * Set initial label values for a track.
+ * Set initial label values for a track.
*
***************************************************************************
*/
@@ -461,13 +461,13 @@ SetTrackInitValues()
/*
***************************************************************************
* SetTrackCurrentValues --
- * Update label values for a track.
+ * Update label values for a track.
*
***************************************************************************
*/
static void
-SetTrackCurrentValues(int iw,
- int pos)
+SetTrackCurrentValues(int iw,
+ int pos)
{
info1.New_Track = FALSE;
info1.alpha_point = wr[iw].infos[pos].alpha_point;
@@ -478,15 +478,15 @@ SetTrackCurrentValues(int iw,
***************************************************************************
*
* PutTrackLoaded --
- * Put track labels information into database.
+ * Put track labels information into database.
*
***************************************************************************
*/
static void
-PutTrackLoaded(int iw)
+PutTrackLoaded(int iw)
{
- int pos = 0, i;
- BOOLEAN found = FALSE;
+ int pos = 0, i;
+ BOOLEAN found = FALSE;
if (wr[iw].NBinfos > 0) {
found = FindPosId(iw, info1.id, &pos);
@@ -495,19 +495,19 @@ PutTrackLoaded(int iw)
/*
* New track.
*/
- if (wr[iw].NBinfos == wr[iw].NBalloc_infos) {
+ if (wr[iw].NBinfos == wr[iw].NBalloc_infos) {
wr[iw].NBalloc_infos += NB_ALLOC;
wr[iw].infos = realloc((void *) wr[iw].infos,
- sizeof(INFOS)*wr[iw].NBalloc_infos);
+ sizeof(INFOS)*wr[iw].NBalloc_infos);
}
if (pos < wr[iw].NBinfos) {
for(i = wr[iw].NBinfos-1; i >= pos; i--) {
- memcpy((char *) &(wr[iw].infos[i+1]), (char *) &(wr[iw].infos[i]),
- sizeof(INFOS));
+ memcpy((char *) &(wr[iw].infos[i+1]), (char *) &(wr[iw].infos[i]),
+ sizeof(INFOS));
}
/* memcpy((char *) &(wr[iw].infos[pos+1]), (char *) &(wr[iw].infos[pos]),
- (wr[iw].NBinfos-pos)*sizeof(INFOS) );*/
+ (wr[iw].NBinfos-pos)*sizeof(INFOS) );*/
}
info1.New_Track = TRUE;
@@ -532,14 +532,14 @@ PutTrackLoaded(int iw)
***************************************************************************
*
* ReadTracks --
- * Get track labels information from zinc.
+ * Get track labels information from zinc.
*
***************************************************************************
*/
static void
-ReadTracks(int iw)
+ReadTracks(int iw)
{
- int i=0;
+ int i=0;
int trash1; /* dummy variable : received unused data */
for (i = 0; i < wr[iw].NBinfos; i++) {
@@ -548,17 +548,17 @@ ReadTracks(int iw)
info1.id = NULL;
while ((info1.id = (*wr[iw]._next_track)(wr[iw].rw, info1.id,
- &info1.x, &info1.y,
- &info1.vv_dx, &info1.vv_dy,
- /* Fri Oct 13 15:15:48 2000
- * &info1.label_x, &info1.label_y,
- * &info1.label_width, &info1.label_height,
- */
- &info1.rho, &info1.theta,
- &info1.visibility,
- &trash1,&trash1,&trash1))) {
+ &info1.x, &info1.y,
+ &info1.vv_dx, &info1.vv_dy,
+ /* Fri Oct 13 15:15:48 2000
+ * &info1.label_x, &info1.label_y,
+ * &info1.label_width, &info1.label_height,
+ */
+ &info1.rho, &info1.theta,
+ &info1.visibility,
+ &trash1,&trash1,&trash1))) {
info1.alpha = (ProjToAngle(info1.vv_dx, info1.vv_dy ) - M_PI_2 -
- DegreesToRadian(info1.theta));
+ DegreesToRadian(info1.theta));
info1.dx = (int) (info1.rho * cos(info1.alpha));
info1.dy = (int) (info1.rho * sin(info1.alpha));
info1.Refresh = TRUE;
@@ -576,7 +576,7 @@ ReadTracks(int iw)
*/
if (wr[iw].infos[i].Refresh == FALSE) {
memcpy((char *) &(wr[iw].infos[i]), (char *) &(wr[iw].infos[i+1]),
- (wr[iw].NBinfos-i-1)*sizeof(INFOS));
+ (wr[iw].NBinfos-i-1)*sizeof(INFOS));
wr[iw].NBinfos--;
}
else {
@@ -589,32 +589,32 @@ ReadTracks(int iw)
***************************************************************************
*
* OmSetNParam --
- * Return 1 if ok, anything else if nok (non existing parameters,
+ * Return 1 if ok, anything else if nok (non existing parameters,
* wrong type).
*
***************************************************************************
*/
int
OmSetNParam(char *name, /* parameter's name */
- void *value)
+ void *value)
{
int accessid = 0;
int status = 0;
while (OmParamAccess[accessid].type != OM_PARAM_END) {
- if (!strcmp(name, OmParamAccess[accessid].name)) {
- /* a parameter named name has been found */
- if (OmParamAccess[accessid].rw) {
- memcpy(OmParamAccess[accessid].data, value,
- (unsigned int) OmParamAccess[accessid].size);
- status = 1;
- break;
- }
- else {
- status = -1 ; /* data is readonly */
- };
- };
- ++accessid;
+ if (!strcmp(name, OmParamAccess[accessid].name)) {
+ /* a parameter named name has been found */
+ if (OmParamAccess[accessid].rw) {
+ memcpy(OmParamAccess[accessid].data, value,
+ (unsigned int) OmParamAccess[accessid].size);
+ status = 1;
+ break;
+ }
+ else {
+ status = -1 ; /* data is readonly */
+ };
+ };
+ ++accessid;
};
return(status);
}
@@ -623,27 +623,27 @@ OmSetNParam(char *name, /* parameter's name */
***************************************************************************
*
* OmGetNParam --
- * Return 1 if ok, anything else if nok (non existing parameters,
+ * Return 1 if ok, anything else if nok (non existing parameters,
* wrong type).
*
***************************************************************************
*/
int
OmGetNParam(char *name, /* parameter's name */
- void *ptvalue)
+ void *ptvalue)
{
int accessid = 0;
int status = 0;
while (OmParamAccess[accessid].type != OM_PARAM_END) {
- if (!strcmp(name, OmParamAccess[accessid].name)) {
- /* a parameter named "name" has been found */
- memcpy(ptvalue, OmParamAccess[accessid].data,
- (unsigned int) OmParamAccess[accessid].size);
- status = 1;
- break;
- };
- ++accessid;
+ if (!strcmp(name, OmParamAccess[accessid].name)) {
+ /* a parameter named "name" has been found */
+ memcpy(ptvalue, OmParamAccess[accessid].data,
+ (unsigned int) OmParamAccess[accessid].size);
+ status = 1;
+ break;
+ };
+ ++accessid;
};
return(status);
}
@@ -652,7 +652,7 @@ OmGetNParam(char *name, /* parameter's name */
***************************************************************************
*
* OmGetNParamList --
- * Return 1 and next index if remains to read, the current param
+ * Return 1 and next index if remains to read, the current param
* being written in current_param. Return 0 if end of list.
*
***************************************************************************
@@ -663,23 +663,23 @@ OmGetNParamList(OmParam *current_param, int *idx_next)
int status = 0 ;
pOMPARAM cparam ;
if (*idx_next < NbParam) {
- cparam = &OmParamAccess[*idx_next];
- current_param->type = cparam->type ;
- strcpy(current_param->name, cparam->name);
- /* printf("value of parameter is %f \n", *((double *)(cparam->data)));
- printf("adresse de K0 %x \n", (int)&K0); */
- ++(*idx_next) ;
- status = 1;
+ cparam = &OmParamAccess[*idx_next];
+ current_param->type = cparam->type ;
+ strcpy(current_param->name, cparam->name);
+ /* printf("value of parameter is %f \n", *((double *)(cparam->data)));
+ printf("adresse de K0 %x \n", (int)&K0); */
+ ++(*idx_next) ;
+ status = 1;
};
return(status);
}
void
OmSetParam(double OmKrepulsion,
- double OmKrepulsionBearing,
- double OmKfriction,
- double OmKbestPositionAttraction,
- double OmKscreenEdgeRepulsion)
+ double OmKrepulsionBearing,
+ double OmKfriction,
+ double OmKbestPositionAttraction,
+ double OmKscreenEdgeRepulsion)
{
K0 = OmKrepulsion;
n0 = OmKrepulsionBearing;
@@ -690,10 +690,10 @@ OmSetParam(double OmKrepulsion,
void
OmGetParam(double *OmKrepulsion,
- double *OmKrepulsionBearing,
- double *OmKfriction,
- double *OmKbestPositionAttraction,
- double *OmKscreenEdgeRepulsion)
+ double *OmKrepulsionBearing,
+ double *OmKfriction,
+ double *OmKbestPositionAttraction,
+ double *OmKscreenEdgeRepulsion)
{
*OmKrepulsion = K0;
*OmKrepulsionBearing = n0;
@@ -704,10 +704,10 @@ OmGetParam(double *OmKrepulsion,
void
OmGetMinParam(double *OmKminRepulsion,
- double *OmKminRepulsionBearing,
- double *OmKminFriction,
- double *OmKminBestPositionAttraction,
- double *OmKminScreenEdgeRepulsion)
+ double *OmKminRepulsionBearing,
+ double *OmKminFriction,
+ double *OmKminBestPositionAttraction,
+ double *OmKminScreenEdgeRepulsion)
{
*OmKminRepulsion = K0min;
*OmKminRepulsionBearing = n0min;
@@ -718,10 +718,10 @@ OmGetMinParam(double *OmKminRepulsion,
void
OmGetMaxParam(double *OmKmaxRepulsion,
- double *OmKmaxRepulsionBearing,
- double *OmKmaxFriction,
- double *OmKmaxBestPositionAttraction,
- double *OmKmaxScreenEdgeRepulsion)
+ double *OmKmaxRepulsionBearing,
+ double *OmKmaxFriction,
+ double *OmKmaxBestPositionAttraction,
+ double *OmKmaxScreenEdgeRepulsion)
{
*OmKmaxRepulsion = K0max;
*OmKmaxRepulsionBearing = n0max;
@@ -735,20 +735,20 @@ OmGetMaxParam(double *OmKmaxRepulsion,
***************************************************************************
*
* SetupLeaderPosition --
- * Setup leader position for new tracks.
+ * Setup leader position for new tracks.
*
***************************************************************************
*/
static void
-SetupLeaderPosition(int iw,
- int ip)
+SetupLeaderPosition(int iw,
+ int ip)
{
- double X10, Y10, X20, Y20;
- double D, k, Fx0, Fy0;
- int jp;
- double alpha;
- BOOLEAN ok = FALSE;
- double dx = 0, dy = 0;
+ double X10, Y10, X20, Y20;
+ double D, k, Fx0, Fy0;
+ int jp;
+ double alpha;
+ BOOLEAN ok = FALSE;
+ double dx = 0, dy = 0;
Fx0 = 0.0;
Fy0 = 0.0;
@@ -758,23 +758,23 @@ SetupLeaderPosition(int iw,
X10 = (double) (wr[iw].infos[ip].x - wr[iw].infos[jp].x - wr[iw].infos[jp].dx);
Y10 = (double) (wr[iw].infos[ip].y - wr[iw].infos[jp].y - wr[iw].infos[jp].dy);
X20 = ((double) (wr[iw].infos[ip].x - wr[iw].infos[jp].x) -
- (double) (wr[iw].infos[jp].dx) * COEF1 +
- (double) (wr[iw].infos[jp].dy) * COEF2);
+ (double) (wr[iw].infos[jp].dx) * COEF1 +
+ (double) (wr[iw].infos[jp].dy) * COEF2);
Y20 = ((double) (wr[iw].infos[ip].y - wr[iw].infos[jp].y) -
- (double) (wr[iw].infos[jp].dy) * COEF1 -
- (double) (wr[iw].infos[jp].dx) * COEF2);
+ (double) (wr[iw].infos[jp].dy) * COEF1 -
+ (double) (wr[iw].infos[jp].dx) * COEF2);
D = X10 * X10 + Y10 * Y10;
if (D > limit_distance) {
- k = K0 / (sqrt(D) * pow(D, n0 - 1.0));
- Fx0 += X10 * k;
- Fy0 += Y10 * k;
+ k = K0 / (sqrt(D) * pow(D, n0 - 1.0));
+ Fx0 += X10 * k;
+ Fy0 += Y10 * k;
}
D = X20 * X20 + Y20 * Y20;
if (D > limit_distance) {
- k = K0 / (sqrt(D) * pow(D, n0 - 1.0));
- Fx0 += X20 * k;
- Fy0 += Y20 * k;
+ k = K0 / (sqrt(D) * pow(D, n0 - 1.0));
+ Fx0 += X20 * k;
+ Fy0 += Y20 * k;
}
}
}
@@ -796,14 +796,14 @@ SetupLeaderPosition(int iw,
for (jp = 0; jp < wr[iw].NBinfos; jp++) {
if (wr[iw].infos[jp].New_Track == FALSE) {
- X10 = (double) (wr[iw].infos[ip].x + (int) dx -
- wr[iw].infos[jp].x - wr[iw].infos[jp].dx);
- Y10 = (double) (wr[iw].infos[ip].y + (int) dy -
- wr[iw].infos[jp].y - wr[iw].infos[jp].dy);
- D = X10 * X10 + Y10 * Y10;
- if (D < placing_min_dist) {
- ok = FALSE;
- }
+ X10 = (double) (wr[iw].infos[ip].x + (int) dx -
+ wr[iw].infos[jp].x - wr[iw].infos[jp].dx);
+ Y10 = (double) (wr[iw].infos[ip].y + (int) dy -
+ wr[iw].infos[jp].y - wr[iw].infos[jp].dy);
+ D = X10 * X10 + Y10 * Y10;
+ if (D < placing_min_dist) {
+ ok = FALSE;
+ }
}
}
alpha += placing_step;
@@ -820,27 +820,27 @@ SetupLeaderPosition(int iw,
***************************************************************************
*
* ComputeRepulsion --
- * Compute the moment of the repulsion forces of all the other
- * tracks.
+ * Compute the moment of the repulsion forces of all the other
+ * tracks.
*
***************************************************************************
*/
static double
-ComputeRepulsion(int iw,
- int ip)
+ComputeRepulsion(int iw,
+ int ip)
{
- double X10, Y10, X00, Y00, X11, Y11, X01, Y01;
- double D0, D1, k, Fx0, Fy0, Fx1, Fy1;
- int jp;
+ double X10, Y10, X00, Y00, X11, Y11, X01, Y01;
+ double D0, D1, k, Fx0, Fy0, Fx1, Fy1;
+ int jp;
X00 = (double) (wr[iw].infos[ip].x + wr[iw].infos[ip].dx);
Y00 = (double) (wr[iw].infos[ip].y + wr[iw].infos[ip].dy);
X01 = ((double) (wr[iw].infos[ip].x) +
- (double) (wr[iw].infos[ip].dx) * COEF1 -
- (double) (wr[iw].infos[ip].dy) * COEF2);
+ (double) (wr[iw].infos[ip].dx) * COEF1 -
+ (double) (wr[iw].infos[ip].dy) * COEF2);
Y01 = ((double) (wr[iw].infos[ip].y) +
- (double) (wr[iw].infos[ip].dy) * COEF1 +
- (double) (wr[iw].infos[ip].dx) * COEF2);
+ (double) (wr[iw].infos[ip].dy) * COEF1 +
+ (double) (wr[iw].infos[ip].dx) * COEF2);
Fx0 = 0.0;
Fy0 = 0.0;
Fx1 = 0.0;
@@ -851,33 +851,33 @@ ComputeRepulsion(int iw,
X10 = (double) (wr[iw].infos[jp].x + wr[iw].infos[jp].dx);
Y10 = (double) (wr[iw].infos[jp].y + wr[iw].infos[jp].dy);
X11 = ((double) (wr[iw].infos[jp].x) +
- (double) (wr[iw].infos[jp].dx) * COEF1 -
- (double) (wr[iw].infos[jp].dy) * COEF2);
+ (double) (wr[iw].infos[jp].dx) * COEF1 -
+ (double) (wr[iw].infos[jp].dy) * COEF2);
Y11 = ((double) (wr[iw].infos[jp].y) +
- (double) (wr[iw].infos[jp].dy) * COEF1 +
- (double) (wr[iw].infos[jp].dx) * COEF2);
+ (double) (wr[iw].infos[jp].dy) * COEF1 +
+ (double) (wr[iw].infos[jp].dx) * COEF2);
D0 = (X10 - X00) * (X10 - X00) + (Y10 - Y00) * (Y10 - Y00);
if (D0 > limit_distance) {
- k = K0 / (sqrt(D0) * pow(D0, n0 - 1.0));
- Fx0 += (X10 - X00) * k;
- Fy0 += (Y10 - Y00) * k;
+ k = K0 / (sqrt(D0) * pow(D0, n0 - 1.0));
+ Fx0 += (X10 - X00) * k;
+ Fy0 += (Y10 - Y00) * k;
}
D1 = (X11 - X01) * (X11 - X01) + (Y11 - Y01) * (Y11 - Y01);
if (D1 > limit_distance) {
- k = K0 / (sqrt(D1) * pow(D1, n0 - 1.0));
- Fx1 += (X11 - X01) * k;
- Fy1 += (Y11 - Y01) * k;
+ k = K0 / (sqrt(D1) * pow(D1, n0 - 1.0));
+ Fx1 += (X11 - X01) * k;
+ Fy1 += (Y11 - Y01) * k;
}
}
}
return -((double) (wr[iw].infos[ip].dx) * Fy0 -
- (double) (wr[iw].infos[ip].dy) * Fx0 +
- (double) (wr[iw].infos[ip].dx) * COEF1 * Fy1 -
- (double) (wr[iw].infos[ip].dy) * COEF2 * Fy1 -
- (double) (wr[iw].infos[ip].dy) * COEF1 * Fx1 -
- (double) (wr[iw].infos[ip].dx) * COEF2 * Fx1);
+ (double) (wr[iw].infos[ip].dy) * Fx0 +
+ (double) (wr[iw].infos[ip].dx) * COEF1 * Fy1 -
+ (double) (wr[iw].infos[ip].dy) * COEF2 * Fy1 -
+ (double) (wr[iw].infos[ip].dy) * COEF1 * Fx1 -
+ (double) (wr[iw].infos[ip].dx) * COEF2 * Fx1);
}
@@ -885,13 +885,13 @@ ComputeRepulsion(int iw,
***************************************************************************
*
* ComputeFriction --
- * Compute the moment of the friction force.
+ * Compute the moment of the friction force.
*
***************************************************************************
*/
static double
-ComputeFriction(int iw,
- int ip)
+ComputeFriction(int iw,
+ int ip)
{
return (double) (-K1 * wr[iw].infos[ip].alpha_point);
}
@@ -899,20 +899,20 @@ ComputeFriction(int iw,
/*
***************************************************************************
- *
+ *
* ComputeDrawback --
- * Compute the moment of the best positions drawback forces.
+ * Compute the moment of the best positions drawback forces.
*
***************************************************************************
*/
static double
-ComputeDrawback(int iw,
- int ip)
+ComputeDrawback(int iw,
+ int ip)
{
- int vx, vy, dx, dy;
- double m = 0;
- double nd = 1.0, nv = 1.0;
- double vi;
+ int vx, vy, dx, dy;
+ double m = 0;
+ double nd = 1.0, nv = 1.0;
+ double vi;
vx = wr[iw].infos[ip].vv_dx;
vy = wr[iw].infos[ip].vv_dy;
@@ -946,19 +946,19 @@ ComputeDrawback(int iw,
***************************************************************************
*
* ComputeDrawbackInView --
- * Compute the moment of the keep in view forces.
+ * Compute the moment of the keep in view forces.
*
***************************************************************************
*/
static double
-DrawbackDirection(int vx,
- int vy,
- int dx,
- int dy)
+DrawbackDirection(int vx,
+ int vy,
+ int dx,
+ int dy)
{
- double m=0;
- double nd=1.0, nv=1.0;
- double vi;
+ double m=0;
+ double nd=1.0, nv=1.0;
+ double vi;
if ((vx != 0) || (vy != 0)) {
nv = sqrt((double)(vx * vx + vy * vy));
@@ -984,14 +984,14 @@ DrawbackDirection(int vx,
static double
-ComputeDrawbackInView(int iw,
- int ip,
- int width,
- int height)
+ComputeDrawbackInView(int iw,
+ int ip,
+ int width,
+ int height)
{
- int r=50;
- int dx, dy;
- double Gamma=0;
+ int r=50;
+ int dx, dy;
+ double Gamma=0;
r = wr[iw].infos[ip].rho;
dx = wr[iw].infos[ip].dx;
@@ -1017,20 +1017,20 @@ ComputeDrawbackInView(int iw,
***************************************************************************
*
* RefineSetup --
- * Refine setup for far spaced tracks.
+ * Refine setup for far spaced tracks.
*
***************************************************************************
*/
static void
-RefineSetup(int iw,
- int ip)
+RefineSetup(int iw,
+ int ip)
{
- double acceleration;
- int i;
+ double acceleration;
+ int i;
for (i = 0; i <= 10; i++) {
acceleration = ComputeRepulsion(iw, ip) + ComputeDrawback(iw, ip);
-
+
if (acceleration > 100) {
acceleration = 100;
}
@@ -1057,79 +1057,79 @@ RefineSetup(int iw,
***************************************************************************
*
* OmProcessOverlap --
- * Overlap Manager main function.
+ * Overlap Manager main function.
*
***************************************************************************
*/
void
-OmProcessOverlap(void *zinc,
- int width,
- int height,
- double scale)
+OmProcessOverlap(void *zinc,
+ int width,
+ int height,
+ double scale)
{
- double acceleration = 0.0;
- int ip, iw;
+ double acceleration = 0.0;
+ int ip, iw;
if (NBzincs != 0 && FindPosW(zinc, &iw) == TRUE) {
ReadTracks(iw);
for (ip = 0; ip < wr[iw].NBinfos; ip++) {
if (wr[iw].infos[ip].New_Track == TRUE) {
- SetupLeaderPosition(iw, ip);
- RefineSetup(iw, ip);
- wr[iw].infos[ip].New_Track = FALSE;
+ SetupLeaderPosition(iw, ip);
+ RefineSetup(iw, ip);
+ wr[iw].infos[ip].New_Track = FALSE;
}
}
for (ip = 0; ip < wr[iw].NBinfos; ip++) {
acceleration = (ComputeRepulsion(iw, ip) + ComputeDrawback(iw, ip) +
- ComputeDrawbackInView(iw, ip, width, height));
+ ComputeDrawbackInView(iw, ip, width, height));
if (acceleration > 100) {
- acceleration = 100;
+ acceleration = 100;
}
if (acceleration < -100) {
- acceleration = -100;
+ acceleration = -100;
}
-
+
wr[iw].infos[ip].alpha_point += acceleration * DELTA_T ;
wr[iw].infos[ip].alpha_point += ComputeFriction(iw, ip) * DELTA_T ;
if (wr[iw].infos[ip].alpha_point > 30) {
- wr[iw].infos[ip].alpha_point = 30;
+ wr[iw].infos[ip].alpha_point = 30;
}
if (wr[iw].infos[ip].alpha_point < -30) {
- wr[iw].infos[ip].alpha_point = -30;
+ wr[iw].infos[ip].alpha_point = -30;
}
wr[iw].infos[ip].alpha += wr[iw].infos[ip].alpha_point * DELTA_T ;
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);
+ 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) {
- wr[iw].infos[ip].theta = 105;
- }
- else {
- wr[iw].infos[ip].theta = 75;
- }
+ if (wr[iw].infos[ip].alpha_point > 0) {
+ wr[iw].infos[ip].theta = 105;
+ }
+ else {
+ wr[iw].infos[ip].theta = 75;
+ }
}
if (wr[iw].infos[ip].theta > 255 && wr[iw].infos[ip].theta < 285) {
- if (wr[iw].infos[ip].alpha_point > 0) {
- wr[iw].infos[ip].theta = 285;
- }
- else {
- wr[iw].infos[ip].theta = 255;
- }
+ if (wr[iw].infos[ip].alpha_point > 0) {
+ wr[iw].infos[ip].theta = 285;
+ }
+ else {
+ wr[iw].infos[ip].theta = 255;
+ }
}
*/
(*wr[iw]._set_label_angle) (wr[iw].rw, wr[iw].infos[ip].id,
- 120, wr[iw].infos[ip].theta);
+ 120, wr[iw].infos[ip].theta);
/* wr[iw].infos[ip].rho*/
}
}