rename variable
This commit is contained in:
parent
94d8bcfcea
commit
ad8b2c3793
@ -38,9 +38,9 @@ struct CI<'a>{
|
||||
index:usize,
|
||||
}
|
||||
impl CI<'_>{
|
||||
fn new(pnv_list:&Vec<Contact>,index:usize)->CI<'_>{
|
||||
fn new(conts:&Vec<Contact>,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<Contact>,
|
||||
conts:&Vec<Contact>,
|
||||
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<Contact>,ray:&Ray,indices:&Indices)->Option<(Planar64,usize)>{
|
||||
pnv_list.iter()
|
||||
fn get_first_touch(conts:&Vec<Contact>,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<Contact>,ray:&Ray,indices:&Indices)->Option<(Pl
|
||||
.min_by_key(|&(t,_)|t)
|
||||
}
|
||||
|
||||
pub fn push_solve(pnv_list:&Vec<Contact>,point:Planar64Vec3)->Option<Planar64Vec3>{
|
||||
pub fn push_solve(conts:&Vec<Contact>,point:Planar64Vec3)->Option<Planar64Vec3>{
|
||||
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<Contact>,point:Planar64Vec3)->Option<Planar64Vec
|
||||
indices.push(next_index);
|
||||
|
||||
let meet_point=ray.extrapolate(next_t);
|
||||
match get_best_push_ray_and_indices(meet_point,pnv_list,indices){
|
||||
match get_best_push_ray_and_indices(meet_point,conts,indices){
|
||||
Some((new_ray,new_indices))=>(ray,indices)=(new_ray,new_indices),
|
||||
None=>return Some(meet_point),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn push_solve_with_output(pnv_list:&Vec<Contact>,point:Planar64Vec3,output:&mut Vec<Planar64Vec3>){
|
||||
pub fn push_solve_with_output(conts:&Vec<Contact>,point:Planar64Vec3,output:&mut Vec<Planar64Vec3>){
|
||||
//
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user