astyle --recursive --indent=spaces=2 --style=kr --indent-col1-comments --break-blocks --convert-tabs --max-code-length=200
This is done for better merging branch/LG_PRE_RELEASE_0.3 into trunk (same process is applied on this branch) git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7073 818b1a75-f10b-46b9-bf7c-635c3b92a50f
This commit is contained in:
+205
-225
@@ -28,12 +28,12 @@
|
||||
*******************************************************************************/
|
||||
|
||||
/*! \file rwp.c
|
||||
* \brief random waypoint mobility generator
|
||||
* \brief random waypoint mobility generator
|
||||
* \author M. Mahersi, N. Nikaein, J. Harri
|
||||
* \date 2011
|
||||
* \version 0.1
|
||||
* \company Eurecom
|
||||
* \email:
|
||||
* \email:
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
@@ -59,30 +59,31 @@ start_rwp_generator (omg_global_param omg_param_list)
|
||||
srand (omg_param_list.seed + RWP);
|
||||
|
||||
LOG_I (OMG, "# RWP mobility model for %d type %d nodes\n", omg_param_list.nodes,
|
||||
omg_param_list.nodes_type);
|
||||
for (id = n_id; id < (omg_param_list.nodes + n_id); id++)
|
||||
{
|
||||
omg_param_list.nodes_type);
|
||||
|
||||
node = create_node ();
|
||||
mobility = create_mobility ();
|
||||
for (id = n_id; id < (omg_param_list.nodes + n_id); id++) {
|
||||
|
||||
node->id = id;
|
||||
node->type = omg_param_list.nodes_type;
|
||||
node->mob = mobility;
|
||||
node->generator = RWP;
|
||||
node->event_num = 0;
|
||||
place_rwp_node (node); //initial positions
|
||||
node = create_node ();
|
||||
mobility = create_mobility ();
|
||||
|
||||
pair = (pair_struct *) malloc (sizeof (struct pair_struct));
|
||||
pair->b = node;
|
||||
sleep_rwp_node (pair, cur_time); //sleep
|
||||
node->id = id;
|
||||
node->type = omg_param_list.nodes_type;
|
||||
node->mob = mobility;
|
||||
node->generator = RWP;
|
||||
node->event_num = 0;
|
||||
place_rwp_node (node); //initial positions
|
||||
|
||||
job_vector_end[RWP] = add_job (pair, job_vector_end[RWP]);
|
||||
if (job_vector[RWP] == NULL)
|
||||
job_vector[RWP] = job_vector_end[RWP];
|
||||
pair = (pair_struct *) malloc (sizeof (struct pair_struct));
|
||||
pair->b = node;
|
||||
sleep_rwp_node (pair, cur_time); //sleep
|
||||
|
||||
job_vector_len[RWP]++;
|
||||
}
|
||||
job_vector_end[RWP] = add_job (pair, job_vector_end[RWP]);
|
||||
|
||||
if (job_vector[RWP] == NULL)
|
||||
job_vector[RWP] = job_vector_end[RWP];
|
||||
|
||||
job_vector_len[RWP]++;
|
||||
}
|
||||
|
||||
n_id += omg_param_list.nodes;
|
||||
|
||||
@@ -90,6 +91,7 @@ start_rwp_generator (omg_global_param omg_param_list)
|
||||
|
||||
if (job_vector[RWP] == NULL)
|
||||
LOG_E (OMG, "[RWP] Job Vector is NULL\n");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -102,45 +104,41 @@ place_rwp_node (node_struct * node)
|
||||
double block_xmin, block_ymin;
|
||||
|
||||
|
||||
if (omg_param_list[node->type].rwp_type == RESTIRICTED_RWP)
|
||||
{
|
||||
loc_num = (int) randomgen (0, omg_param_list[node->type].max_vertices);
|
||||
node->x_pos =
|
||||
(double) vertice_xpos (loc_num, omg_param_list[node->type]);
|
||||
node->y_pos =
|
||||
(double) vertice_ypos (loc_num, omg_param_list[node->type]);
|
||||
//LOG_D(OMG,"location number %d x pos %.2f y pos %.2f \n\n",loc_num,node->x_pos,node->y_pos);
|
||||
}
|
||||
else if (omg_param_list[node->type].rwp_type == CONNECTED_DOMAIN)
|
||||
{
|
||||
node->block_num =
|
||||
(int) randomgen (0, omg_param_list[node->type].max_block_num);
|
||||
block_xmin = area_minx (node->block_num, omg_param_list[node->type]);
|
||||
block_ymin = area_miny (node->block_num, omg_param_list[node->type]);
|
||||
if (omg_param_list[node->type].rwp_type == RESTIRICTED_RWP) {
|
||||
loc_num = (int) randomgen (0, omg_param_list[node->type].max_vertices);
|
||||
node->x_pos =
|
||||
(double) vertice_xpos (loc_num, omg_param_list[node->type]);
|
||||
node->y_pos =
|
||||
(double) vertice_ypos (loc_num, omg_param_list[node->type]);
|
||||
//LOG_D(OMG,"location number %d x pos %.2f y pos %.2f \n\n",loc_num,node->x_pos,node->y_pos);
|
||||
} else if (omg_param_list[node->type].rwp_type == CONNECTED_DOMAIN) {
|
||||
node->block_num =
|
||||
(int) randomgen (0, omg_param_list[node->type].max_block_num);
|
||||
block_xmin = area_minx (node->block_num, omg_param_list[node->type]);
|
||||
block_ymin = area_miny (node->block_num, omg_param_list[node->type]);
|
||||
|
||||
node->x_pos =
|
||||
(double) ((int) (randomgen (block_xmin, xloc_div + block_xmin) * 100))
|
||||
/ 100;
|
||||
node->x_pos =
|
||||
(double) ((int) (randomgen (block_xmin, xloc_div + block_xmin) * 100))
|
||||
/ 100;
|
||||
|
||||
node->y_pos =
|
||||
(double) ((int) (randomgen (block_ymin, yloc_div + block_ymin) * 100))
|
||||
/ 100;
|
||||
node->y_pos =
|
||||
(double) ((int) (randomgen (block_ymin, yloc_div + block_ymin) * 100))
|
||||
/ 100;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
node->x_pos =
|
||||
(double) ((int)
|
||||
(randomgen
|
||||
(omg_param_list[node->type].min_x,
|
||||
omg_param_list[node->type].max_x) * 100)) / 100;
|
||||
} else {
|
||||
node->x_pos =
|
||||
(double) ((int)
|
||||
(randomgen
|
||||
(omg_param_list[node->type].min_x,
|
||||
omg_param_list[node->type].max_x) * 100)) / 100;
|
||||
|
||||
node->y_pos =
|
||||
(double) ((int)
|
||||
(randomgen
|
||||
(omg_param_list[node->type].min_y,
|
||||
omg_param_list[node->type].max_y) * 100)) / 100;
|
||||
}
|
||||
|
||||
node->y_pos =
|
||||
(double) ((int)
|
||||
(randomgen
|
||||
(omg_param_list[node->type].min_y,
|
||||
omg_param_list[node->type].max_y) * 100)) / 100;
|
||||
}
|
||||
node->mob->x_from = node->x_pos;
|
||||
node->mob->x_to = node->x_pos;
|
||||
node->mob->y_from = node->y_pos;
|
||||
@@ -148,8 +146,8 @@ place_rwp_node (node_struct * node)
|
||||
node->mob->speed = 0.0;
|
||||
node->mob->journey_time = 0.0;
|
||||
LOG_I (OMG,
|
||||
" #[RWP] Initial position of node ID: %d type: %d (X = %.2f, Y = %.2f) speed = 0.0\n ",
|
||||
node->id, node->type, node->x_pos, node->y_pos);
|
||||
" #[RWP] Initial position of node ID: %d type: %d (X = %.2f, Y = %.2f) speed = 0.0\n ",
|
||||
node->id, node->type, node->x_pos, node->y_pos);
|
||||
|
||||
node_vector_end[node->type] =
|
||||
(node_list *) add_entry (node, node_vector_end[node->type]);
|
||||
@@ -176,16 +174,16 @@ sleep_rwp_node (pair_struct * pair, double cur_time)
|
||||
|
||||
node->mob->sleep_duration =
|
||||
(double) ((int)
|
||||
(randomgen
|
||||
(omg_param_list[node->type].min_sleep,
|
||||
omg_param_list[node->type].max_sleep) * 100)) / 100;
|
||||
(randomgen
|
||||
(omg_param_list[node->type].min_sleep,
|
||||
omg_param_list[node->type].max_sleep) * 100)) / 100;
|
||||
/*LOG_D (OMG, "#[RWP] node: %d \tsleep duration : %.2f\n", node->id,
|
||||
node->mob->sleep_duration); */
|
||||
|
||||
node->mob->start_journey = cur_time;
|
||||
pair->next_event_t = cur_time + node->mob->sleep_duration; //when to wake up
|
||||
pair->next_event_t = cur_time + node->mob->sleep_duration; //when to wake up
|
||||
// LOG_D (OMG, "[RWP] wake up at time: cur_time + sleep_duration : %.2f\n",
|
||||
// pair->a);
|
||||
// pair->a);
|
||||
|
||||
|
||||
|
||||
@@ -208,98 +206,91 @@ move_rwp_node (pair_struct * pair, double cur_time)
|
||||
node->mobile = 1;
|
||||
|
||||
|
||||
if (omg_param_list[node->type].rwp_type == RESTIRICTED_RWP)
|
||||
{
|
||||
do
|
||||
{
|
||||
loc_num =
|
||||
(int) randomgen (0, omg_param_list[node->type].max_vertices);
|
||||
node->mob->x_to =
|
||||
(double) vertice_xpos (loc_num, omg_param_list[node->type]);
|
||||
node->mob->y_to =
|
||||
(double) vertice_ypos (loc_num, omg_param_list[node->type]);
|
||||
|
||||
|
||||
}
|
||||
while (node->mob->x_to == node->mob->x_from
|
||||
&& node->mob->y_to == node->mob->y_from);
|
||||
|
||||
distance = fabs (node->mob->x_to - node->mob->x_from) +
|
||||
fabs (node->mob->y_to - node->mob->y_from);
|
||||
|
||||
/* LOG_D(OMG,"#location number %d x pos to %.2f y pos to %.2f x pos from %.2f y pos from %.2f\n\n",loc_num,node->mob->x_to,node->mob->y_to,node->mob->x_from,node->mob->y_from); */
|
||||
|
||||
}
|
||||
else if (omg_param_list[node->type].rwp_type == CONNECTED_DOMAIN)
|
||||
{
|
||||
pr = randomgen (0, 1);
|
||||
|
||||
if (pr <= 0.50)
|
||||
/*node->block_num =
|
||||
(int) randomgen (0, omg_param_list[node->type].max_block_num); */
|
||||
node->block_num =
|
||||
(int) next_block (node->block_num, omg_param_list[node->type]);
|
||||
|
||||
block_xmin = area_minx (node->block_num, omg_param_list[node->type]);
|
||||
block_ymin = area_miny (node->block_num, omg_param_list[node->type]);
|
||||
|
||||
if (omg_param_list[node->type].rwp_type == RESTIRICTED_RWP) {
|
||||
do {
|
||||
loc_num =
|
||||
(int) randomgen (0, omg_param_list[node->type].max_vertices);
|
||||
node->mob->x_to =
|
||||
(double) ((int) (randomgen (block_xmin, xloc_div + block_xmin) * 100))
|
||||
/ 100;
|
||||
|
||||
(double) vertice_xpos (loc_num, omg_param_list[node->type]);
|
||||
node->mob->y_to =
|
||||
(double) ((int) (randomgen (block_ymin, yloc_div + block_ymin) * 100))
|
||||
/ 100;
|
||||
|
||||
distance =
|
||||
(double) ((int) (sqrtf
|
||||
(pow (node->mob->x_from - node->mob->x_to, 2) +
|
||||
pow (node->mob->y_from - node->mob->y_to,
|
||||
2)) * 100)) / 100;
|
||||
|
||||
node->mob->azimuth = atan2 (node->mob->y_to - node->mob->y_from, node->mob->x_to - node->mob->x_from); //radian
|
||||
}
|
||||
else
|
||||
{
|
||||
node->mob->x_to =
|
||||
(double) ((int)
|
||||
(randomgen
|
||||
(omg_param_list[node->type].min_x,
|
||||
omg_param_list[node->type].max_x) * 100)) / 100;
|
||||
|
||||
node->mob->y_to =
|
||||
(double) ((int)
|
||||
(randomgen
|
||||
(omg_param_list[node->type].min_y,
|
||||
omg_param_list[node->type].max_y) * 100)) / 100;
|
||||
(double) vertice_ypos (loc_num, omg_param_list[node->type]);
|
||||
|
||||
|
||||
distance =
|
||||
(double) ((int) (sqrtf (pow (node->mob->x_from - node->mob->x_to, 2) +
|
||||
pow (node->mob->y_from - node->mob->y_to,
|
||||
2)) * 100)) / 100;
|
||||
} while (node->mob->x_to == node->mob->x_from
|
||||
&& node->mob->y_to == node->mob->y_from);
|
||||
|
||||
node->mob->azimuth = atan2 (node->mob->y_to - node->mob->y_from, node->mob->x_to - node->mob->x_from); //radian
|
||||
}
|
||||
distance = fabs (node->mob->x_to - node->mob->x_from) +
|
||||
fabs (node->mob->y_to - node->mob->y_from);
|
||||
|
||||
/* LOG_D(OMG,"#location number %d x pos to %.2f y pos to %.2f x pos from %.2f y pos from %.2f\n\n",loc_num,node->mob->x_to,node->mob->y_to,node->mob->x_from,node->mob->y_from); */
|
||||
|
||||
} else if (omg_param_list[node->type].rwp_type == CONNECTED_DOMAIN) {
|
||||
pr = randomgen (0, 1);
|
||||
|
||||
if (pr <= 0.50)
|
||||
/*node->block_num =
|
||||
(int) randomgen (0, omg_param_list[node->type].max_block_num); */
|
||||
node->block_num =
|
||||
(int) next_block (node->block_num, omg_param_list[node->type]);
|
||||
|
||||
block_xmin = area_minx (node->block_num, omg_param_list[node->type]);
|
||||
block_ymin = area_miny (node->block_num, omg_param_list[node->type]);
|
||||
|
||||
node->mob->x_to =
|
||||
(double) ((int) (randomgen (block_xmin, xloc_div + block_xmin) * 100))
|
||||
/ 100;
|
||||
|
||||
node->mob->y_to =
|
||||
(double) ((int) (randomgen (block_ymin, yloc_div + block_ymin) * 100))
|
||||
/ 100;
|
||||
|
||||
distance =
|
||||
(double) ((int) (sqrtf
|
||||
(pow (node->mob->x_from - node->mob->x_to, 2) +
|
||||
pow (node->mob->y_from - node->mob->y_to,
|
||||
2)) * 100)) / 100;
|
||||
|
||||
node->mob->azimuth = atan2 (node->mob->y_to - node->mob->y_from, node->mob->x_to - node->mob->x_from); //radian
|
||||
} else {
|
||||
node->mob->x_to =
|
||||
(double) ((int)
|
||||
(randomgen
|
||||
(omg_param_list[node->type].min_x,
|
||||
omg_param_list[node->type].max_x) * 100)) / 100;
|
||||
|
||||
node->mob->y_to =
|
||||
(double) ((int)
|
||||
(randomgen
|
||||
(omg_param_list[node->type].min_y,
|
||||
omg_param_list[node->type].max_y) * 100)) / 100;
|
||||
|
||||
|
||||
distance =
|
||||
(double) ((int) (sqrtf (pow (node->mob->x_from - node->mob->x_to, 2) +
|
||||
pow (node->mob->y_from - node->mob->y_to,
|
||||
2)) * 100)) / 100;
|
||||
|
||||
node->mob->azimuth = atan2 (node->mob->y_to - node->mob->y_from, node->mob->x_to - node->mob->x_from); //radian
|
||||
}
|
||||
|
||||
|
||||
node->mob->speed =
|
||||
(double) ((int)
|
||||
(randomgen
|
||||
(omg_param_list[node->type].min_speed,
|
||||
omg_param_list[node->type].max_speed) * 100)) / 100;
|
||||
journeytime_next = (double) ((int) (distance / node->mob->speed * 100)) / 100; //duration to get to dest
|
||||
(randomgen
|
||||
(omg_param_list[node->type].min_speed,
|
||||
omg_param_list[node->type].max_speed) * 100)) / 100;
|
||||
journeytime_next = (double) ((int) (distance / node->mob->speed * 100)) / 100; //duration to get to dest
|
||||
|
||||
/* LOG_D (OMG, "#[RWP] %d mob->journey_time_next %.2f distance %.2f speed %.2f\n \n",node->id, journeytime_next, distance,node->mob->speed);
|
||||
*/
|
||||
node->mob->start_journey = cur_time;
|
||||
//LOG_D (OMG, "[RWP] start_journey %.2f\n", node->mob->start_journey);
|
||||
pair->next_event_t = cur_time + journeytime_next; //when to reach the destination
|
||||
pair->next_event_t = cur_time + journeytime_next; //when to reach the destination
|
||||
// LOG_D (OMG,
|
||||
// "[RWP] reaching the destination at time : start journey + journey_time next =%.2f\n",
|
||||
// pair->a);
|
||||
/*
|
||||
if (node->event_num < 100)
|
||||
if (node->event_num < 100)
|
||||
{
|
||||
event_sum[node->event_num] += node->mob->speed;
|
||||
events[node->event_num]++;
|
||||
@@ -318,50 +309,48 @@ update_rwp_nodes (double cur_time)
|
||||
int done = 0;
|
||||
job_list *tmp = job_vector[RWP];
|
||||
node_struct *my_node;
|
||||
while (tmp != NULL && done == 0)
|
||||
{
|
||||
//case1:time to next event equals to current time
|
||||
if (tmp->pair != NULL
|
||||
&& ((double) tmp->pair->next_event_t >= cur_time - omg_eps)
|
||||
&& ((double) tmp->pair->next_event_t <= cur_time + omg_eps))
|
||||
{
|
||||
my_node = tmp->pair->b;
|
||||
if (my_node->mobile == 1)
|
||||
sleep_rwp_node (tmp->pair, cur_time);
|
||||
else
|
||||
move_rwp_node (tmp->pair, cur_time);
|
||||
|
||||
}
|
||||
//case2: current time is greater than the time to next event
|
||||
while (tmp != NULL && done == 0) {
|
||||
//case1:time to next event equals to current time
|
||||
if (tmp->pair != NULL
|
||||
&& ((double) tmp->pair->next_event_t >= cur_time - omg_eps)
|
||||
&& ((double) tmp->pair->next_event_t <= cur_time + omg_eps)) {
|
||||
my_node = tmp->pair->b;
|
||||
|
||||
else if (tmp->pair != NULL
|
||||
&& (cur_time - omg_eps) > tmp->pair->next_event_t)
|
||||
{
|
||||
|
||||
my_node = tmp->pair->b;
|
||||
while (cur_time >= tmp->pair->next_event_t)
|
||||
{
|
||||
if (my_node->mobile == 1)
|
||||
sleep_rwp_node (tmp->pair, cur_time);
|
||||
else
|
||||
move_rwp_node (tmp->pair, cur_time);
|
||||
|
||||
}
|
||||
}
|
||||
//case3: current time less than the time to next event
|
||||
if (my_node->mobile == 1)
|
||||
sleep_rwp_node (tmp->pair, cur_time);
|
||||
else
|
||||
{
|
||||
done = 1; //quit the loop
|
||||
}
|
||||
move_rwp_node (tmp->pair, cur_time);
|
||||
|
||||
|
||||
tmp = tmp->next;
|
||||
}
|
||||
//case2: current time is greater than the time to next event
|
||||
|
||||
else if (tmp->pair != NULL
|
||||
&& (cur_time - omg_eps) > tmp->pair->next_event_t) {
|
||||
|
||||
my_node = tmp->pair->b;
|
||||
|
||||
while (cur_time >= tmp->pair->next_event_t) {
|
||||
if (my_node->mobile == 1)
|
||||
sleep_rwp_node (tmp->pair, cur_time);
|
||||
else
|
||||
move_rwp_node (tmp->pair, cur_time);
|
||||
|
||||
}
|
||||
}
|
||||
//case3: current time less than the time to next event
|
||||
else {
|
||||
done = 1; //quit the loop
|
||||
}
|
||||
|
||||
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
//sorting the new entries
|
||||
//LOG_D (OMG, "--------DISPLAY JOB LIST--------\n"); //LOG_T
|
||||
// display_job_list (job_vector);
|
||||
job_vector[RWP] = quick_sort (job_vector[RWP]); ///////////
|
||||
job_vector[RWP] = quick_sort (job_vector[RWP]); ///////////
|
||||
// LOG_D (OMG, "--------DISPLAY JOB LIST AFTER SORTING--------\n");
|
||||
//display_job_list (job_vector[RWP]);
|
||||
}
|
||||
@@ -375,73 +364,64 @@ get_rwp_positions_updated (double cur_time)
|
||||
double len, dx, dy;
|
||||
job_list *tmp = job_vector[RWP];
|
||||
|
||||
while (tmp != NULL)
|
||||
{
|
||||
while (tmp != NULL) {
|
||||
|
||||
if (tmp->pair->b->mobile == 1 && tmp->pair->next_event_t >= cur_time)
|
||||
{
|
||||
if (tmp->pair->b->mobile == 1 && tmp->pair->next_event_t >= cur_time) {
|
||||
|
||||
if (omg_param_list[tmp->pair->b->type].rwp_type == RESTIRICTED_RWP)
|
||||
{
|
||||
len =
|
||||
tmp->pair->b->mob->speed * (cur_time -
|
||||
tmp->pair->b->mob->start_journey);
|
||||
dx = fabs (tmp->pair->b->mob->x_from - tmp->pair->b->mob->x_to);
|
||||
if (omg_param_list[tmp->pair->b->type].rwp_type == RESTIRICTED_RWP) {
|
||||
len =
|
||||
tmp->pair->b->mob->speed * (cur_time -
|
||||
tmp->pair->b->mob->start_journey);
|
||||
dx = fabs (tmp->pair->b->mob->x_from - tmp->pair->b->mob->x_to);
|
||||
|
||||
if (dx < len)
|
||||
{
|
||||
tmp->pair->b->x_pos = tmp->pair->b->mob->x_to;
|
||||
tmp->pair->b->y_pos =
|
||||
tmp->pair->b->mob->y_from + (len -
|
||||
dx) *
|
||||
((tmp->pair->b->mob->y_to -
|
||||
tmp->pair->b->mob->y_from) /
|
||||
fabs (tmp->pair->b->mob->y_to -
|
||||
tmp->pair->b->mob->y_from));
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp->pair->b->y_pos = tmp->pair->b->mob->y_from;
|
||||
tmp->pair->b->x_pos = tmp->pair->b->mob->x_from + len *
|
||||
((tmp->pair->b->mob->x_to - tmp->pair->b->mob->x_from)
|
||||
/ fabs (tmp->pair->b->mob->x_to -
|
||||
tmp->pair->b->mob->x_from));
|
||||
}
|
||||
if (dx < len) {
|
||||
tmp->pair->b->x_pos = tmp->pair->b->mob->x_to;
|
||||
tmp->pair->b->y_pos =
|
||||
tmp->pair->b->mob->y_from + (len -
|
||||
dx) *
|
||||
((tmp->pair->b->mob->y_to -
|
||||
tmp->pair->b->mob->y_from) /
|
||||
fabs (tmp->pair->b->mob->y_to -
|
||||
tmp->pair->b->mob->y_from));
|
||||
} else {
|
||||
tmp->pair->b->y_pos = tmp->pair->b->mob->y_from;
|
||||
tmp->pair->b->x_pos = tmp->pair->b->mob->x_from + len *
|
||||
((tmp->pair->b->mob->x_to - tmp->pair->b->mob->x_from)
|
||||
/ fabs (tmp->pair->b->mob->x_to -
|
||||
tmp->pair->b->mob->x_from));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
len =
|
||||
tmp->pair->b->mob->speed * (cur_time -
|
||||
tmp->pair->b->mob->start_journey);
|
||||
else {
|
||||
len =
|
||||
tmp->pair->b->mob->speed * (cur_time -
|
||||
tmp->pair->b->mob->start_journey);
|
||||
|
||||
|
||||
dx = len * cos (tmp->pair->b->mob->azimuth);
|
||||
dy = len * sin (tmp->pair->b->mob->azimuth);
|
||||
dx = len * cos (tmp->pair->b->mob->azimuth);
|
||||
dy = len * sin (tmp->pair->b->mob->azimuth);
|
||||
|
||||
x_now = tmp->pair->b->mob->x_from + dx;
|
||||
y_now = tmp->pair->b->mob->y_from + dy;
|
||||
x_now = tmp->pair->b->mob->x_from + dx;
|
||||
y_now = tmp->pair->b->mob->y_from + dy;
|
||||
|
||||
tmp->pair->b->x_pos = (double) ((int) (x_now * 100)) / 100;
|
||||
tmp->pair->b->y_pos = (double) ((int) (y_now * 100)) / 100;
|
||||
tmp->pair->b->x_pos = (double) ((int) (x_now * 100)) / 100;
|
||||
tmp->pair->b->y_pos = (double) ((int) (y_now * 100)) / 100;
|
||||
|
||||
|
||||
|
||||
} //grid
|
||||
} //grid
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp->pair->b->x_pos = tmp->pair->b->mob->x_to;
|
||||
tmp->pair->b->y_pos = tmp->pair->b->mob->y_to;
|
||||
}
|
||||
|
||||
/*if(tmp->pair->b->id==2 && ((int)(cur_time*1000)% 100)==0)
|
||||
LOG_D (OMG, "# %d %.2f %.2f \n\n",tmp->pair->b->id,tmp->pair->b->x_pos,tmp->pair->b->y_pos); */
|
||||
tmp = tmp->next;
|
||||
|
||||
} else {
|
||||
tmp->pair->b->x_pos = tmp->pair->b->mob->x_to;
|
||||
tmp->pair->b->y_pos = tmp->pair->b->mob->y_to;
|
||||
}
|
||||
|
||||
/*if(tmp->pair->b->id==2 && ((int)(cur_time*1000)% 100)==0)
|
||||
LOG_D (OMG, "# %d %.2f %.2f \n\n",tmp->pair->b->id,tmp->pair->b->x_pos,tmp->pair->b->y_pos); */
|
||||
tmp = tmp->next;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user