fail without crash

This commit is contained in:
2025-11-27 11:37:50 -08:00
parent 348769a270
commit 1752c51b8f

View File

@@ -657,12 +657,24 @@ impl MinkowskiMesh<'_>{
MinkowskiVert::VertVert(self.mesh0.farthest_vert(dir),self.mesh1.farthest_vert(-dir))
}
pub fn predict_collision_in(&self,relative_body:&Body,range:impl RangeBounds<Time>)->Option<(MinkowskiFace,GigaTime)>{
let fev=crate::minimum_difference::closest_fev_not_inside(self,relative_body.position)?.unwrap();
let fev=match crate::minimum_difference::closest_fev_not_inside(self,relative_body.position)?{
Ok(fev)=>fev,
Err(_)=>{
println!("oh noes");
return None;
}
};
//continue forwards along the body parabola
fev.crawl(self,relative_body,range.start_bound(),range.end_bound()).hit()
}
pub fn predict_collision_out(&self,relative_body:&Body,range:impl RangeBounds<Time>)->Option<(MinkowskiFace,GigaTime)>{
let fev=crate::minimum_difference::closest_fev_not_inside(self,relative_body.position)?.unwrap();
let fev=match crate::minimum_difference::closest_fev_not_inside(self,relative_body.position)?{
Ok(fev)=>fev,
Err(_)=>{
println!("oh noes");
return None;
}
};
let (lower_bound,upper_bound)=(range.start_bound(),range.end_bound());
// swap and negate bounds to do a time inversion
let (lower_bound,upper_bound)=(upper_bound.map(|&t|-t),lower_bound.map(|&t|-t));