Compare commits
No commits in common. "127e0d23ca89ddceeca4b9dc7953a7860cd0b37a" and "087cefb13a3939950df528abec884f10b5826021" have entirely different histories.
127e0d23ca
...
087cefb13a
@ -19,6 +19,6 @@ aux_source_directory(./src SRC_LIST)
|
|||||||
|
|
||||||
add_executable(${PROJECT_NAME} ${SRC_LIST} "${HEADERS}")
|
add_executable(${PROJECT_NAME} ${SRC_LIST} "${HEADERS}")
|
||||||
|
|
||||||
target_link_libraries(${PROJECT_NAME} ${SOUP_LIBRARIES} ${JSON_LIBRARIES} m)
|
target_link_libraries(${PROJECT_NAME} ${SOUP_LIBRARIES} ${JSON_LIBRARIES})
|
||||||
|
|
||||||
install (TARGETS ${PROJECT_NAME} DESTINATION bin)
|
install (TARGETS ${PROJECT_NAME} DESTINATION bin)
|
||||||
|
@ -147,17 +147,6 @@ struct dijkstra_path *dijkstra_path_dup_shallow(struct dijkstra_path *path)
|
|||||||
return dup;
|
return dup;
|
||||||
}
|
}
|
||||||
|
|
||||||
dijkstra_cost dijkstra_get_weight_from_distance(struct dijkstra_node *node_a,
|
|
||||||
struct dijkstra_node *node_b)
|
|
||||||
{
|
|
||||||
float dist;
|
|
||||||
|
|
||||||
dist = sqrt(pow(node_a->position.x - node_b->position.x, 2) +
|
|
||||||
pow(node_a->position.y - node_b->position.y, 2));
|
|
||||||
|
|
||||||
return (dijkstra_cost) dist;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief dijkstra_path_new creates a new dijkstra_path between two nodes.
|
* \brief dijkstra_path_new creates a new dijkstra_path between two nodes.
|
||||||
* \param name the name of the path (pointer is not copied and must stay valid!)
|
* \param name the name of the path (pointer is not copied and must stay valid!)
|
||||||
@ -173,11 +162,7 @@ struct dijkstra_path *dijkstra_path_new(char *name,
|
|||||||
path = malloc(sizeof(*path));
|
path = malloc(sizeof(*path));
|
||||||
if (path) {
|
if (path) {
|
||||||
path->name = name;
|
path->name = name;
|
||||||
if (path->weight == DIJKSTRA_WEIGHT_AUTO)
|
path->weight = weight;
|
||||||
path->weight = dijkstra_get_weight_from_distance(source,
|
|
||||||
destination);
|
|
||||||
else
|
|
||||||
path->weight = weight;
|
|
||||||
|
|
||||||
dijkstra_connect_nodes_to_path(source, destination, path);
|
dijkstra_connect_nodes_to_path(source, destination, path);
|
||||||
}
|
}
|
||||||
@ -219,6 +204,8 @@ int dijkstra_path_intersect(struct dijkstra_solver *solver,
|
|||||||
float s1_x, s1_y, s2_x, s2_y;
|
float s1_x, s1_y, s2_x, s2_y;
|
||||||
float s, t;
|
float s, t;
|
||||||
|
|
||||||
|
int is_new;
|
||||||
|
|
||||||
if (!path_a || !path_b)
|
if (!path_a || !path_b)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
#define DIJKSTRA_WEIGHT_AUTO (-1)
|
|
||||||
|
|
||||||
typedef int dijkstra_cost;
|
typedef int dijkstra_cost;
|
||||||
|
|
||||||
struct dijkstra_solver {
|
struct dijkstra_solver {
|
||||||
|
@ -83,8 +83,7 @@ int add_geojson_to_dijkstra(struct dijkstra_solver *solver,
|
|||||||
dijkstra_path_new_to_list(solver,
|
dijkstra_path_new_to_list(solver,
|
||||||
x_last, y_last,
|
x_last, y_last,
|
||||||
x, y,
|
x, y,
|
||||||
name,
|
name, 1);
|
||||||
DIJKSTRA_WEIGHT_AUTO);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
x_last = x;
|
x_last = x;
|
||||||
|
Loading…
Reference in New Issue
Block a user