diff --git a/src/bvh.rs b/src/bvh.rs index b76c239..c95e2e4 100644 --- a/src/bvh.rs +++ b/src/bvh.rs @@ -137,19 +137,27 @@ 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; + //locate a run of values equal to the median //partition point gives the first index for which the predicate evaluates to false - let first_index_gt_median_x=sort_x.partition_point(|tup|!(median_x