mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-28 20:29:04 +03:00
adjust dedupe threshold so there arent tiny little gaps in intersections
This commit is contained in:
parent
7ea56ad6ca
commit
e95baab153
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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(
|
||||
|
Loading…
Reference in New Issue
Block a user