Fix walking direction heading
This commit is contained in:
parent
d219007e71
commit
0fbbd374a7
@ -248,11 +248,10 @@ int dijkstra_search_route_to_geojson(struct dijkstra_search *search,
|
|||||||
for (l = route; l != NULL; l = l->next) {
|
for (l = route; l != NULL; l = l->next) {
|
||||||
node = (struct dijkstra_node*) l->data;
|
node = (struct dijkstra_node*) l->data;
|
||||||
if (node_last) {
|
if (node_last) {
|
||||||
heading = atanf((node->position.y - node_last->position.y) / (node->position.x - node_last->position.x)) / (M_PI * 2) * 360;
|
heading = atan2f((node->position.y - node_last->position.y), (node->position.x - node_last->position.x)) / (M_PI * 2) * 360;
|
||||||
heading = atanf((node->position.y - node_last->position.y) / (node->position.x - node_last->position.x)) / (M_PI * 2) * 360;
|
if (last_heading - heading > 25) {
|
||||||
if (last_heading - heading > 10) {
|
|
||||||
relative_direction_str = "right";
|
relative_direction_str = "right";
|
||||||
} else if (last_heading - heading < -10) {
|
} else if (last_heading - heading < -25) {
|
||||||
relative_direction_str = "left";
|
relative_direction_str = "left";
|
||||||
} else {
|
} else {
|
||||||
relative_direction_str = "straight";
|
relative_direction_str = "straight";
|
||||||
|
Loading…
Reference in New Issue
Block a user