mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-01 19:27:11 +03:00
improve dead-ends by using a shared sidewalk corner, not a crosswalk
This commit is contained in:
parent
1d5064ca1b
commit
9995bed6ab
@ -194,6 +194,12 @@ pub fn calculate_corners(i: &Intersection, map: &Map, timer: &mut Timer) -> Vec<
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Special case for dead-ends: just thicken the geometry.
|
||||||
|
if i.roads.len() == 1 {
|
||||||
|
corners.push(turn.geom.make_polygons(LANE_THICKNESS));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
let l1 = map.get_l(turn.id.src);
|
let l1 = map.get_l(turn.id.src);
|
||||||
let l2 = map.get_l(turn.id.dst);
|
let l2 = map.get_l(turn.id.dst);
|
||||||
|
|
||||||
|
@ -307,7 +307,7 @@ fn make_walking_turns(
|
|||||||
if let Some(l1) = get_sidewalk(lanes, roads[idx1].incoming_lanes(i.id)) {
|
if let Some(l1) = get_sidewalk(lanes, roads[idx1].incoming_lanes(i.id)) {
|
||||||
// Make the crosswalk to the other side
|
// Make the crosswalk to the other side
|
||||||
if let Some(l2) = get_sidewalk(lanes, roads[idx1].outgoing_lanes(i.id)) {
|
if let Some(l2) = get_sidewalk(lanes, roads[idx1].outgoing_lanes(i.id)) {
|
||||||
if roads.len() != 2 {
|
if roads.len() > 2 {
|
||||||
result.extend(make_crosswalks(i.id, l1, l2));
|
result.extend(make_crosswalks(i.id, l1, l2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -366,6 +366,27 @@ fn make_walking_turns(
|
|||||||
result.extend(turns);
|
result.extend(turns);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if roads.len() == 1 {
|
||||||
|
if let Some(l1) = get_sidewalk(lanes, roads[0].incoming_lanes(i.id)) {
|
||||||
|
if let Some(l2) = get_sidewalk(lanes, roads[0].outgoing_lanes(i.id)) {
|
||||||
|
let geom = make_shared_sidewalk_corner(i, l1, l2, timer);
|
||||||
|
result.push(Turn {
|
||||||
|
id: turn_id(i.id, l1.id, l2.id),
|
||||||
|
turn_type: TurnType::SharedSidewalkCorner,
|
||||||
|
other_crosswalk_ids: BTreeSet::new(),
|
||||||
|
geom: geom.clone(),
|
||||||
|
lookup_idx: 0,
|
||||||
|
});
|
||||||
|
result.push(Turn {
|
||||||
|
id: turn_id(i.id, l2.id, l1.id),
|
||||||
|
turn_type: TurnType::SharedSidewalkCorner,
|
||||||
|
other_crosswalk_ids: BTreeSet::new(),
|
||||||
|
geom: geom.reversed(),
|
||||||
|
lookup_idx: 0,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user