diff --git a/src/bvh.rs b/src/bvh.rs index ee73355..b76c239 100644 --- a/src/bvh.rs +++ b/src/bvh.rs @@ -121,13 +121,11 @@ fn generate_bvh_node(boxen:Vec<(T,Aabb)>,force:bool)->BvhNode{ aabb, } }else{ - let mut octant=std::collections::HashMap::with_capacity(n);//this ids which octant the boxen is put in let mut sort_x=Vec::with_capacity(n); let mut sort_y=Vec::with_capacity(n); let mut sort_z=Vec::with_capacity(n); for (i,(_,aabb)) in boxen.iter().enumerate(){ let center=aabb.center(); - octant.insert(i,0); sort_x.push((i,center.x())); sort_y.push((i,center.y())); sort_z.push((i,center.z())); @@ -139,26 +137,26 @@ fn generate_bvh_node(boxen:Vec<(T,Aabb)>,force:bool)->BvhNode{ let median_x=sort_x[h].1; let median_y=sort_y[h].1; let median_z=sort_z[h].1; - for (i,c) in sort_x{ - if median_x