adjust dedupe threshold so there arent tiny little gaps in intersections

This commit is contained in:
Dustin Carlino 2019-02-08 22:51:01 -08:00
parent 7ea56ad6ca
commit e95baab153
2 changed files with 17 additions and 6 deletions

View File

@ -155,8 +155,15 @@ pub fn calculate_corners(i: &Intersection, map: &Map) -> Vec<Polygon> {
}
pts_between.push(dst_line.pt1());
corners.push(Polygon::new(&pts_between));
} else {
error!(
"Couldn't make geometry for {}. look for {} to {} in {:?}",
turn.id,
corner2,
corner1,
i.polygon.points()
);
}
// TODO Do something else when this fails? Hmm
}
}
@ -365,15 +372,19 @@ pub fn draw_signal_diagram(
}
fn find_pts_between(pts: &Vec<Pt2D>, start: Pt2D, end: Pt2D) -> Option<Vec<Pt2D>> {
// TODO This threshold is higher than the 0.1 intersection polygons use to dedupe because of
// jagged lane teeth from bad polyline shifting. Seemingly.
let threshold = Distance::meters(0.5);
let mut result = Vec::new();
for pt in pts {
if result.is_empty() && pt.approx_eq(start, Distance::meters(1.0)) {
if result.is_empty() && pt.approx_eq(start, threshold) {
result.push(*pt);
} else if !result.is_empty() {
result.push(*pt);
}
// start and end might be the same.
if !result.is_empty() && pt.approx_eq(end, Distance::meters(1.0)) {
if !result.is_empty() && pt.approx_eq(end, threshold) {
return Some(result);
}
}
@ -386,7 +397,7 @@ fn find_pts_between(pts: &Vec<Pt2D>, start: Pt2D, end: Pt2D) -> Option<Vec<Pt2D>
// Go through again, looking for end
for pt in pts {
result.push(*pt);
if pt.approx_eq(end, Distance::meters(1.0)) {
if pt.approx_eq(end, threshold) {
return Some(result);
}
}

View File

@ -63,7 +63,7 @@ pub fn intersection_polygon(
if endpoints
.last()
.unwrap()
.approx_eq(endpoints[0], Distance::meters(1.0))
.approx_eq(endpoints[0], Distance::meters(0.1))
{
endpoints.pop();
}
@ -220,7 +220,7 @@ fn generalized_trim_back(
}
}
// TODO Caller will close off the polygon. Does that affect our dedupe?
Pt2D::approx_dedupe(endpoints, Distance::meters(1.0))
Pt2D::approx_dedupe(endpoints, Distance::meters(0.1))
}
fn deadend(