Introduce a penalty for entering / leaving the train
Done by upping the cost for walking on an access layer.
This commit is contained in:
parent
aa7256c12e
commit
faa5d7ca4b
@ -175,7 +175,8 @@ dijkstra_cost dijkstra_get_weight_from_distance(struct dijkstra_node *node_a,
|
|||||||
float scale;
|
float scale;
|
||||||
|
|
||||||
switch (net_type) {
|
switch (net_type) {
|
||||||
case TRAINLINE:
|
case TRAINLINE: // Trainlines and access types use the z-coordinate
|
||||||
|
case ACCESS: // for cost scaling.
|
||||||
scale = (float)node_a->position.z;
|
scale = (float)node_a->position.z;
|
||||||
scale += (float)node_b->position.z;
|
scale += (float)node_b->position.z;
|
||||||
scale /= 200;
|
scale /= 200;
|
||||||
|
@ -102,7 +102,10 @@ int add_geojson_to_dijkstra(struct dijkstra_solver *solver,
|
|||||||
z_last = 0; // By default, let's assume height 0
|
z_last = 0; // By default, let's assume height 0
|
||||||
break;
|
break;
|
||||||
case TRAINLINE:
|
case TRAINLINE:
|
||||||
z_last = 1000; // By default, let's assume 5x normal speed
|
z_last = 1000; // By default, let's assume 10x normal speed
|
||||||
|
break;
|
||||||
|
case ACCESS:
|
||||||
|
z_last = 10; // By default, let's introduce a penalty to get on the train (ACCESS walk 10x slower)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
z_last = -1;
|
z_last = -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user