allow a NaN in kinematics

This commit is contained in:
Dustin Carlino 2019-01-30 15:02:12 -08:00
parent 0c6f7c424d
commit 3e00789960
4 changed files with 4 additions and 4 deletions

View File

@ -5,7 +5,6 @@
- try fixed pt again, for determinism purposes mostly
- go through and use less f64's... like LANE_THICKNESS, make_polygons, Circle::new, project_away
- audit inner_foo()'s
- rerun import, all tests, screenshots
- change internal pt2d representation to int. JUST get that working first.
- clamp distances first, not points?

View File

@ -851,7 +851,7 @@ impl DrivingSimState {
};
let body = if let Some(ref parking) = c.parking {
let progress: f64 = (time - parking.started_at).as_time() / TIME_TO_PARK_OR_DEPART;
let progress = (time - parking.started_at).as_time() / TIME_TO_PARK_OR_DEPART;
assert!(progress >= 0.0 && progress <= 1.0);
let project_away_ratio = if parking.is_parking {
progress

View File

@ -166,7 +166,8 @@ impl Vehicle {
/ (2.0 * dist.inner_meters()),
);
// TODO might validlyish be NaN, so just f64 here
let required_time: f64 = (speed / normal_case * -1.0).inner_seconds();
let required_time =
-1.0 * speed.inner_meters_per_second() / normal_case.inner_meters_per_second_squared();
if self.debug {
debug!(

View File

@ -312,7 +312,7 @@ impl Pedestrian {
);
let line = Line::new(sidewalk_pos.pt(map), street_pos.pt(map));
let progress: f64 = (now - bp.started_at).as_time() / TIME_TO_PREPARE_BIKE;
let progress = (now - bp.started_at).as_time() / TIME_TO_PREPARE_BIKE;
assert!(progress >= 0.0 && progress <= 1.0);
let ratio = if bp.is_parking {
1.0 - progress