restore center pts at the correct end... and then confirm that

intersection polygons look mostly better by restoring first
This commit is contained in:
Dustin Carlino 2019-01-27 14:30:30 -08:00
parent 9fc41078c2
commit 79c316c9d9
2 changed files with 9 additions and 32 deletions

View File

@ -2,18 +2,16 @@
## Geometry ## Geometry
- bad polyline shifting remains... sr176
- generalized_trim_back - generalized_trim_back
- breaks down when we have jagged lane endings due to polyline shift angle correction - 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? - sometimes a lane polyline hits the perpendicular of a trimmed road! where was this happening?
- handle small roads again somehow? - handle small roads again somehow?
- try merging with roads and intersections, but with new trimmed road lengths - VERY overeager... ate half of the map
- restoring pts happens at the WRONG END. :D
- can we capture snapshots of it now somehow? I can think of one expensive way... - can we capture snapshots of it now somehow? I can think of one expensive way...
- VERY overeager... ate half of the map - deal with loop roads
- resulting polygons are sometimes bad... o40
- 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. - 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.

View File

@ -8,20 +8,18 @@ pub fn short_roads(map: &mut InitialMap) {
// o228 // o228
merge(map, StableRoadID(311)); merge(map, StableRoadID(311));
/*
// o201 // o201
merge(map, StableRoadID(240)); merge(map, StableRoadID(240));
// o37 // o37
merge(map, StableRoadID(91)); merge(map, StableRoadID(91));
// o40 -- this one includes a bad point! // o40
merge(map, StableRoadID(59)); merge(map, StableRoadID(59));
// o25 // o25
merge(map, StableRoadID(389)); merge(map, StableRoadID(389));
merge(map, StableRoadID(22)); merge(map, StableRoadID(22));
*/
} }
if false { if false {
@ -31,7 +29,7 @@ pub fn short_roads(map: &mut InitialMap) {
if let Some(r) = map if let Some(r) = map
.roads .roads
.values() .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); merge(map, r.id);
} else { } 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 // TODO Ah, we can also wind up with multiple roads between the same intersections here. Should
// probably auto-remove those too. // 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 // 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 // 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. // side, requiring us to recalculate that polygon too.
for id in &map.intersections[&keep_i].roads { for id in &map.intersections[&keep_i].roads {
let r = map.roads.get_mut(id).unwrap(); let r = map.roads.get_mut(id).unwrap();
// Safe to do 'else' here, because we removed the loop roads. // 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 if let Some(append) = r
.original_center_pts .original_center_pts
.get_slice_starting_at(r.trimmed_center_pts.last_pt()) .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); 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 { } else {
if let Some(prepend) = r if let Some(prepend) = r
.original_center_pts .original_center_pts
.get_slice_ending_at(r.trimmed_center_pts.first_pt()) .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); 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(); let mut i = map.intersections.get_mut(&keep_i).unwrap();
//i.polygon = geometry::intersection_polygon(i, &mut map.roads); i.polygon = geometry::intersection_polygon(i, &mut map.roads);
} }