diff --git a/src/model_physics.rs b/src/model_physics.rs index bc190d4..af596df 100644 --- a/src/model_physics.rs +++ b/src/model_physics.rs @@ -751,13 +751,20 @@ impl MinkowskiMesh<'_>{ } best_edge.map(|e|(e.as_undirected(),best_time)) } + fn infinity_in(&self,infinity_body:crate::physics::Body)->Option<(MinkowskiFace,integer::Time)>{ + let infinity_fev=self.infinity_fev(-infinity_body.velocity,infinity_body.position); + match crate::face_crawler::crawl_fev(infinity_fev,self,&infinity_body,integer::Time::MIN,infinity_body.time){ + crate::face_crawler::CrawlResult::Miss(_)=>None, + crate::face_crawler::CrawlResult::Hit(face,time)=>Some((face,time)), + } + } pub fn is_point_in_mesh(&self,point:Planar64Vec3)->bool{ let infinity_body=crate::physics::Body::new(point,Planar64Vec3::Y,Planar64Vec3::ZERO,integer::Time::ZERO); //movement must escape the mesh forwards and backwards in time, //otherwise the point is not inside the mesh - self.predict_collision_out(&infinity_body,integer::Time::MAX) + self.infinity_in(infinity_body) .is_some_and(|_| - self.predict_collision_out(&-infinity_body,integer::Time::MAX) + self.infinity_in(-infinity_body) .is_some() ) }