From 79c316c9d937bc47d4046f7dc99f66c5c6b6f231 Mon Sep 17 00:00:00 2001 From: Dustin Carlino Date: Sun, 27 Jan 2019 14:30:30 -0800 Subject: [PATCH] restore center pts at the correct end... and then confirm that intersection polygons look mostly better by restoring first --- docs/TODO_quality.md | 10 ++++------ map_model/src/make/initial/merge.rs | 31 +++++------------------------ 2 files changed, 9 insertions(+), 32 deletions(-) diff --git a/docs/TODO_quality.md b/docs/TODO_quality.md index ce61cc2a10..0bae3526c9 100644 --- a/docs/TODO_quality.md +++ b/docs/TODO_quality.md @@ -2,18 +2,16 @@ ## Geometry +- bad polyline shifting remains... sr176 + - generalized_trim_back - breaks down when we have jagged lane endings due to polyline shift angle correction - sometimes a lane polyline hits the perpendicular of a trimmed road! where was this happening? - handle small roads again somehow? - - try merging with roads and intersections, but with new trimmed road lengths - - restoring pts happens at the WRONG END. :D - + - VERY overeager... ate half of the map - can we capture snapshots of it now somehow? I can think of one expensive way... - - VERY overeager... ate half of the map - - resulting polygons are sometimes bad... o40 - - deal with loop roads + - deal with loop roads - manually draw a picture of the weird intersection to see what would look reasonable. i think we need original road bands from deleted stuff to make decent polygons. diff --git a/map_model/src/make/initial/merge.rs b/map_model/src/make/initial/merge.rs index 943a44798e..eb359e42d5 100644 --- a/map_model/src/make/initial/merge.rs +++ b/map_model/src/make/initial/merge.rs @@ -8,20 +8,18 @@ pub fn short_roads(map: &mut InitialMap) { // o228 merge(map, StableRoadID(311)); - /* // o201 merge(map, StableRoadID(240)); // o37 merge(map, StableRoadID(91)); - // o40 -- this one includes a bad point! + // o40 merge(map, StableRoadID(59)); // o25 merge(map, StableRoadID(389)); merge(map, StableRoadID(22)); - */ } if false { @@ -31,7 +29,7 @@ pub fn short_roads(map: &mut InitialMap) { if let Some(r) = map .roads .values() - .find(|r| r.trimmed_center_pts.length() < 3.0 * si::M) + .find(|r| r.trimmed_center_pts.length() < 15.0 * si::M) { merge(map, r.id); } else { @@ -96,48 +94,29 @@ fn merge(map: &mut InitialMap, merge_road: StableRoadID) { // TODO Ah, we can also wind up with multiple roads between the same intersections here. Should // probably auto-remove those too. - // TODO Crazy polyline bugs happening from doing this. Sigh. // Restore the road geometry on the relevant side to its original length, since that can affect // the polygon. Note we can't just copy over the original points -- that'd clobber the other // side, requiring us to recalculate that polygon too. for id in &map.intersections[&keep_i].roads { let r = map.roads.get_mut(id).unwrap(); // Safe to do 'else' here, because we removed the loop roads. - if r.src_i == keep_i { + if r.dst_i == keep_i { if let Some(append) = r .original_center_pts .get_slice_starting_at(r.trimmed_center_pts.last_pt()) { - let len1 = r.trimmed_center_pts.length(); - //println!("case1: for {}, {} EXTEND {}", r.id, r.trimmed_center_pts, append); r.trimmed_center_pts = r.trimmed_center_pts.clone().extend(&append); - //println!("... yields {}\n\n", r.trimmed_center_pts); - note(format!( - "Restored pts for {}. {} -> {}", - r.id, - len1, - r.trimmed_center_pts.length() - )); } } else { if let Some(prepend) = r .original_center_pts .get_slice_ending_at(r.trimmed_center_pts.first_pt()) { - let len1 = r.trimmed_center_pts.length(); - //println!("case2: for {}, {} EXTEND {}", r.id, prepend, r.trimmed_center_pts); r.trimmed_center_pts = prepend.extend(&r.trimmed_center_pts); - //println!("... yields {}\n\n", r.trimmed_center_pts); - note(format!( - "Restored pts for {}. {} -> {}", - r.id, - len1, - r.trimmed_center_pts.length() - )); } } } - //let mut i = map.intersections.get_mut(&keep_i).unwrap(); - //i.polygon = geometry::intersection_polygon(i, &mut map.roads); + let mut i = map.intersections.get_mut(&keep_i).unwrap(); + i.polygon = geometry::intersection_polygon(i, &mut map.roads); }