adjust degenerate intersections: only one crosswalk, reduce size of it

This commit is contained in:
Dustin Carlino 2019-09-09 12:28:19 -07:00
parent 2d3c079db5
commit 18abb85431
3 changed files with 98 additions and 47 deletions

View File

@ -1,21 +1,21 @@
ccd3c265462a433fa05918339d335136 ../data/screenshots/pending_montlake/01x01_i64.png
d72641b8f45ee94ad234e7ff0fa1eb6b ../data/screenshots/pending_montlake/02x01_i6.png
ee81e4b28722905342a4a4d1ba863372 ../data/screenshots/pending_montlake/03x01_i4.png
46e61b3d29c1c16672f0d40aaa8e298b ../data/screenshots/pending_montlake/01x02_i14.png
de0852250b441a2ef850c31f4de3ea2a ../data/screenshots/pending_montlake/02x02_i143.png
491ba91ac518f3c186f2004a141e4f97 ../data/screenshots/pending_montlake/03x02_i44.png
a0606f349794b1fd56977b5830d4d21a ../data/screenshots/pending_montlake/01x03_i110.png
3d04383ec34fdaa2c5b52454e0f20004 ../data/screenshots/pending_montlake/02x03_i10.png
e6ed4a0142261c75315d8c23994c5c5f ../data/screenshots/pending_montlake/03x03_i21.png
e52c71e9bd676f9c0336f698d3644414 ../data/screenshots/pending_montlake/01x04_i8.png
473d9cce942cf75ee958e36fd2ed7d4b ../data/screenshots/pending_montlake/02x04_i0.png
0264b4fbecf087917dd323e34d7b4f5f ../data/screenshots/pending_montlake/03x04_i20.png
288ab3a12174b35110f2d10bee23b725 ../data/screenshots/pending_montlake/01x05_i53.png
2aa1b08ca985991696e9401c8b503f0d ../data/screenshots/pending_montlake/02x05_i52.png
cd3ad204a7d2b97d80eaa3405afa96b9 ../data/screenshots/pending_montlake/03x05_i30.png
7000ca3b95d1ec60bec870d5b32dfb8d ../data/screenshots/pending_montlake/01x06_i18.png
eba4bc047fd6777def2468d75324a56d ../data/screenshots/pending_montlake/02x06_i16.png
e034675efbeaae9018cb1fe07a77585b ../data/screenshots/pending_montlake/03x06_i1.png
666741e6386e6c3bf9bd238cde458ca6 ../data/screenshots/pending_montlake/01x07_i118.png
316842d496294bda2e0421f18a1c5f4a ../data/screenshots/pending_montlake/02x07_i28.png
abc8ccd06d463f241a51fc53c2f85509 ../data/screenshots/pending_montlake/03x07_i27.png
234fbc9b1d97732e752290b46cd0c29e ../data/screenshots/pending_montlake/01x01_i64.png
36a414e700c0947e694b21ccf1d0f62f ../data/screenshots/pending_montlake/02x01_i6.png
1585545a721c993742c5038b612201a6 ../data/screenshots/pending_montlake/03x01_i4.png
5400607d8efd2c778fc73ce6542bcd37 ../data/screenshots/pending_montlake/01x02_i14.png
159767ead9636521cabb334ed54e76b5 ../data/screenshots/pending_montlake/02x02_i143.png
64da7c631701f4b81f8b41e4a75d2f36 ../data/screenshots/pending_montlake/03x02_i44.png
1d62305c1bd14cb724394f674c9aef7e ../data/screenshots/pending_montlake/01x03_i110.png
6e817aa1fbe5ccdca005af1abe962925 ../data/screenshots/pending_montlake/02x03_i10.png
4f510a36bd63ed7439e1f11d7203d66f ../data/screenshots/pending_montlake/03x03_i21.png
4bc326311ae34853a973d67038cf10d0 ../data/screenshots/pending_montlake/01x04_i8.png
fb15841e08df5f92dbd6dad7af73b1df ../data/screenshots/pending_montlake/02x04_i0.png
959144d3f7092fd933dbe631c96d907a ../data/screenshots/pending_montlake/03x04_i20.png
e49a1f924f562de74b4117921d301025 ../data/screenshots/pending_montlake/01x05_i53.png
9ac173fc2d1e08acbaca537b5f5e450b ../data/screenshots/pending_montlake/02x05_i52.png
8d43caab8a86396db6bcf6b0a61ee95a ../data/screenshots/pending_montlake/03x05_i30.png
a9adac2fe4faf4fafe3f45c5174fabfe ../data/screenshots/pending_montlake/01x06_i18.png
7463b091e97ed3b05e483fb81b941152 ../data/screenshots/pending_montlake/02x06_i16.png
bf03f4b726161279a36de32261507828 ../data/screenshots/pending_montlake/03x06_i1.png
37e923bb648a767448ea838c052a8024 ../data/screenshots/pending_montlake/01x07_i118.png
86601dda380f83d99f840516a16f5725 ../data/screenshots/pending_montlake/02x07_i28.png
c451f02d6a4a56f75e3d7081c341dcbe ../data/screenshots/pending_montlake/03x07_i27.png

View File

@ -4,7 +4,7 @@ use abstutil::{wraparound_get, Timer, Warn};
use geom::{Distance, Line, PolyLine, Pt2D};
use std::collections::{BTreeMap, HashMap};
const DEGENERATE_INTERSECTION_HALF_LENGTH: Distance = Distance::const_meters(5.0);
const DEGENERATE_INTERSECTION_HALF_LENGTH: Distance = Distance::const_meters(2.5);
// The polygon should exist entirely within the thick bands around all original roads -- it just
// carves up part of that space, doesn't reach past it.
@ -93,14 +93,15 @@ fn generalized_trim_back(
};
// Always trim back a minimum amount, if possible.
let mut shortest_center = if road_center.length() >= DEGENERATE_INTERSECTION_HALF_LENGTH {
road_center.exact_slice(
Distance::ZERO,
road_center.length() - DEGENERATE_INTERSECTION_HALF_LENGTH,
)
} else {
road_center.clone()
};
let mut shortest_center =
if road_center.length() >= DEGENERATE_INTERSECTION_HALF_LENGTH + geom::EPSILON_DIST {
road_center.exact_slice(
Distance::ZERO,
road_center.length() - DEGENERATE_INTERSECTION_HALF_LENGTH,
)
} else {
road_center.clone()
};
for (r2, pl2, _) in &road_lines {
if r1 == r2 {
@ -307,27 +308,21 @@ fn deadend(
i: StableIntersectionID,
lines: &Vec<(StableRoadID, Line, PolyLine, PolyLine)>,
) -> Warn<Vec<Pt2D>> {
let len = DEGENERATE_INTERSECTION_HALF_LENGTH * 4.0;
let (id, _, pl_a, pl_b) = &lines[0];
let pt1 = pl_a
.reversed()
.safe_dist_along(DEGENERATE_INTERSECTION_HALF_LENGTH * 2.0)
.map(|(pt, _)| pt);
let pt2 = pl_b
.reversed()
.safe_dist_along(DEGENERATE_INTERSECTION_HALF_LENGTH * 2.0)
.map(|(pt, _)| pt);
let pt1 = pl_a.reversed().safe_dist_along(len).map(|(pt, _)| pt);
let pt2 = pl_b.reversed().safe_dist_along(len).map(|(pt, _)| pt);
if pt1.is_some() && pt2.is_some() {
let r = roads.get_mut(&id).unwrap();
if r.src_i == i {
r.trimmed_center_pts = r.trimmed_center_pts.exact_slice(
DEGENERATE_INTERSECTION_HALF_LENGTH * 2.0,
r.trimmed_center_pts.length(),
);
r.trimmed_center_pts = r
.trimmed_center_pts
.exact_slice(len, r.trimmed_center_pts.length());
} else {
r.trimmed_center_pts = r.trimmed_center_pts.exact_slice(
Distance::ZERO,
r.trimmed_center_pts.length() - DEGENERATE_INTERSECTION_HALF_LENGTH * 2.0,
);
r.trimmed_center_pts = r
.trimmed_center_pts
.exact_slice(Distance::ZERO, r.trimmed_center_pts.length() - len);
}
Warn::ok(close_off_polygon(vec![

View File

@ -276,7 +276,9 @@ 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)) {
result.extend(make_crosswalks(i.id, l1, l2));
if roads.len() != 2 {
result.extend(make_crosswalks(i.id, l1, l2));
}
}
// Find the shared corner
@ -315,6 +317,13 @@ fn make_walking_turns(
}
}
}
if roads.len() == 2 {
if let Some(turns) = make_degenerate_crosswalks(i.id, lanes, roads[0], roads[1]) {
result.extend(turns);
}
}
result
}
@ -343,6 +352,53 @@ fn make_crosswalks(i: IntersectionID, l1: &Lane, l2: &Lane) -> Vec<Turn> {
]
}
// Only one physical crosswalk for degenerate intersections, right in the middle.
fn make_degenerate_crosswalks(
i: IntersectionID,
lanes: &Vec<Lane>,
r1: &Road,
r2: &Road,
) -> Option<Vec<Turn>> {
let l1_in = get_sidewalk(lanes, r1.incoming_lanes(i))?;
let l1_out = get_sidewalk(lanes, r1.outgoing_lanes(i))?;
let l2_in = get_sidewalk(lanes, r2.incoming_lanes(i))?;
let l2_out = get_sidewalk(lanes, r2.outgoing_lanes(i))?;
let pt1 = Line::new(l1_in.last_pt(), l2_out.first_pt()).percent_along(0.5);
let pt2 = Line::new(l1_out.first_pt(), l2_in.last_pt()).percent_along(0.5);
if pt1.epsilon_eq(pt2) {
return None;
}
Some(vec![
Turn {
id: turn_id(i, l1_in.id, l1_out.id),
turn_type: TurnType::Crosswalk,
geom: PolyLine::new(vec![l1_in.last_pt(), pt1, pt2, l1_out.first_pt()]),
lookup_idx: 0,
},
Turn {
id: turn_id(i, l1_out.id, l1_in.id),
turn_type: TurnType::Crosswalk,
geom: PolyLine::new(vec![l1_out.first_pt(), pt2, pt1, l1_in.last_pt()]),
lookup_idx: 0,
},
Turn {
id: turn_id(i, l2_in.id, l2_out.id),
turn_type: TurnType::Crosswalk,
geom: PolyLine::new(vec![l2_in.last_pt(), pt2, pt1, l2_out.first_pt()]),
lookup_idx: 0,
},
Turn {
id: turn_id(i, l2_out.id, l2_in.id),
turn_type: TurnType::Crosswalk,
geom: PolyLine::new(vec![l2_out.first_pt(), pt1, pt2, l2_in.last_pt()]),
lookup_idx: 0,
},
])
}
fn make_shared_sidewalk_corner(
i: &Intersection,
l1: &Lane,