improve dead-ends by using a shared sidewalk corner, not a crosswalk

This commit is contained in:
Dustin Carlino 2019-10-30 10:10:28 -07:00
parent 1d5064ca1b
commit 9995bed6ab
2 changed files with 28 additions and 1 deletions

View File

@ -194,6 +194,12 @@ pub fn calculate_corners(i: &Intersection, map: &Map, timer: &mut Timer) -> Vec<
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 l2 = map.get_l(turn.id.dst);

View File

@ -307,7 +307,7 @@ fn make_walking_turns(
if let Some(l1) = get_sidewalk(lanes, roads[idx1].incoming_lanes(i.id)) {
// Make the crosswalk to the other side
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));
}
}
@ -366,6 +366,27 @@ fn make_walking_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
}