diff --git a/src/push_solve.rs b/src/push_solve.rs index 1d24109..18a9315 100644 --- a/src/push_solve.rs +++ b/src/push_solve.rs @@ -38,9 +38,9 @@ struct CI<'a>{ index:usize, } impl CI<'_>{ - fn new(pnv_list:&Vec,index:usize)->CI<'_>{ + fn new(conts:&Vec,index:usize)->CI<'_>{ CI{ - contact:&pnv_list[index], + contact:&conts[index], index } } @@ -273,14 +273,14 @@ fn get_best_push_ray_and_indices_4(point:Planar64Vec3,ci0:CI,ci1:CI,ci2:CI,ci3:C fn get_best_push_ray_and_indices( point:Planar64Vec3, - pnv_list:&Vec, + conts:&Vec, indices:Indices, )->Option<(Ray,Indices)>{ match indices.as_slice(){ - &[i0,i1,i2,i3]=>get_best_push_ray_and_indices_4(point,CI::new(pnv_list,i0),CI::new(pnv_list,i1),CI::new(pnv_list,i2),CI::new(pnv_list,i3)), - &[i0,i1,i2]=>get_best_push_ray_and_indices_3(point,CI::new(pnv_list,i0),CI::new(pnv_list,i1),CI::new(pnv_list,i2)), - &[i0,i1]=>get_best_push_ray_and_indices_2(point,CI::new(pnv_list,i0),CI::new(pnv_list,i1)), - &[i0]=>get_best_push_ray_and_indices_1(point,CI::new(pnv_list,i0)), + &[i0,i1,i2,i3]=>get_best_push_ray_and_indices_4(point,CI::new(conts,i0),CI::new(conts,i1),CI::new(conts,i2),CI::new(conts,i3)), + &[i0,i1,i2]=>get_best_push_ray_and_indices_3(point,CI::new(conts,i0),CI::new(conts,i1),CI::new(conts,i2)), + &[i0,i1]=>get_best_push_ray_and_indices_2(point,CI::new(conts,i0),CI::new(conts,i1)), + &[i0]=>get_best_push_ray_and_indices_1(point,CI::new(conts,i0)), &[]=>get_best_push_ray_and_indices_0(point), _=>unreachable!(), } @@ -289,8 +289,8 @@ fn get_best_push_ray_and_indices( fn get_touch_time(ray:&Ray,c:&Contact)->Planar64{ (ray.origin-c.position).dot(c.normal)/(c.velocity-ray.direction).dot(c.normal) } -fn get_first_touch(pnv_list:&Vec,ray:&Ray,indices:&Indices)->Option<(Planar64,usize)>{ - pnv_list.iter() +fn get_first_touch(conts:&Vec,ray:&Ray,indices:&Indices)->Option<(Planar64,usize)>{ + conts.iter() .enumerate() .filter(|&(i,contact)| !indices.contains(&i) @@ -300,10 +300,10 @@ fn get_first_touch(pnv_list:&Vec,ray:&Ray,indices:&Indices)->Option<(Pl .min_by_key(|&(t,_)|t) } -pub fn push_solve(pnv_list:&Vec,point:Planar64Vec3)->Option{ +pub fn push_solve(conts:&Vec,point:Planar64Vec3)->Option{ let (mut ray,mut indices)=get_best_push_ray_and_indices_0(point)?; loop{ - let (next_t,next_index)=get_first_touch(pnv_list,&ray,&indices)?; + let (next_t,next_index)=get_first_touch(conts,&ray,&indices)?; if Planar64::ZERO<=next_t{ return Some(ray.origin); @@ -316,13 +316,13 @@ pub fn push_solve(pnv_list:&Vec,point:Planar64Vec3)->Option(ray,indices)=(new_ray,new_indices), None=>return Some(meet_point), } } } -pub fn push_solve_with_output(pnv_list:&Vec,point:Planar64Vec3,output:&mut Vec){ +pub fn push_solve_with_output(conts:&Vec,point:Planar64Vec3,output:&mut Vec){ // }