fix problem with trace_route requesting invalid start dist

This commit is contained in:
Dustin Carlino 2018-10-17 15:18:35 -07:00
parent 452677672f
commit ec49d2dd20
2 changed files with 7 additions and 1 deletions

View File

@ -25,7 +25,7 @@ pub use polyline::PolyLine;
pub use pt::{HashablePt2D, Pt2D};
use std::marker;
// About .0 inches... which is quite tiny on the scale of things. :)
// About 0.4 inches... which is quite tiny on the scale of things. :)
pub const EPSILON_DIST: si::Meter<f64> = si::Meter {
value_unsafe: 0.01,
_marker: marker::PhantomData,

View File

@ -284,6 +284,12 @@ impl Car {
// from AORTA, IIRC, is to make cars stop anywhere in a small buffer at the end of the
// lane.
if leftover_dist <= EPSILON_DIST {
if leftover_dist > 0.0 * si::M {
// But do force them to be right at the end of the Traversable, otherwise we're
// in this bizarre, illegal state where dist_along is > the current
// Traversable's length.
self.dist_along = self.on.length(map) - EPSILON_DIST;
}
break;
}
let next_on = match self.on {