From 16abe23e97fa43b943398551a1a2275e4db6e10b Mon Sep 17 00:00:00 2001 From: Quaternions Date: Thu, 9 Jan 2025 06:27:50 -0800 Subject: [PATCH] push solve tweaks --- strafe-client/src/push_solve.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/strafe-client/src/push_solve.rs b/strafe-client/src/push_solve.rs index 937b2990..26d1770d 100644 --- a/strafe-client/src/push_solve.rs +++ b/strafe-client/src/push_solve.rs @@ -277,9 +277,9 @@ fn get_best_push_ray_and_conts_4<'a>(point:Planar64Vec3,c0:&'a Contact,c1:&'a Co fn get_best_push_ray_and_conts<'a>( point:Planar64Vec3, - conts:Conts<'a>, + conts:&[&'a Contact], )->Option<(Ray,Conts<'a>)>{ - match conts.as_slice(){ + match conts{ &[c0,c1,c2,c3]=>get_best_push_ray_and_conts_4(point,c0,c1,c2,c3), &[c0,c1,c2]=>get_best_push_ray_and_conts_3(point,c0,c1,c2), &[c0,c1]=>get_best_push_ray_and_conts_2(point,c0,c1), @@ -300,15 +300,14 @@ fn get_first_touch<'a>(contacts:&'a Vec,ray:&Ray,conts:&Conts)->Option< } pub fn push_solve(contacts:&Vec,point:Planar64Vec3)->Planar64Vec3{ - const ZERO:Ratio,Fixed<1,32>>=Ratio::new(Fixed::ZERO,Fixed::EPSILON); let (mut ray,mut conts)=get_best_push_ray_and_conts_0(point); loop{ let (next_t,next_cont)=match get_first_touch(contacts,&ray,&conts){ - Some((t,conts))=>(t,conts), + Some((t,cont))=>(t,cont), None=>return ray.origin, }; - if ZERO.le_ratio(next_t){ + if RATIO_ZERO.le_ratio(next_t){ return ray.origin; } @@ -323,7 +322,7 @@ pub fn push_solve(contacts:&Vec,point:Planar64Vec3)->Planar64Vec3{ } let meet_point=ray.extrapolate(next_t); - match get_best_push_ray_and_conts(meet_point,conts){ + match get_best_push_ray_and_conts(meet_point,conts.as_slice()){ Some((new_ray,new_conts))=>(ray,conts)=(new_ray,new_conts), None=>return meet_point, }