diff --git a/src/kdtree/build_naive.rs b/src/kdtree/build_naive.rs index 295d1762..032db399 100644 --- a/src/kdtree/build_naive.rs +++ b/src/kdtree/build_naive.rs @@ -1,3 +1,5 @@ +use nalgebra::vector; + use crate::{ geometry::{ aap::{Aap, Axis}, @@ -33,7 +35,7 @@ fn median(values: &[f32]) -> f32 { impl KdTreeBuilder for MedianKdTreeBuilder { fn starting_box(&self) -> KdBox { KdBox { - boundary: triangles_bounding_box(&self.triangles), + boundary: triangles_bounding_box(&self.triangles).enlarge(&vector![0.5, 0.5, 0.5]), triangle_indices: (0u32..self.triangles.len() as u32).collect(), } } diff --git a/src/kdtree/build_sah.rs b/src/kdtree/build_sah.rs index fd81e2d4..c4abe0ca 100644 --- a/src/kdtree/build_sah.rs +++ b/src/kdtree/build_sah.rs @@ -1,3 +1,4 @@ +use nalgebra::vector; use rayon::prelude::*; use crate::{ @@ -57,7 +58,7 @@ impl SahKdTreeBuilder { impl KdTreeBuilder for SahKdTreeBuilder { fn starting_box(&self) -> KdBox { KdBox { - boundary: triangles_bounding_box(&self.triangles), + boundary: triangles_bounding_box(&self.triangles).enlarge(&vector![0.5, 0.5, 0.5]), triangle_indices: (0u32..self.triangles.len() as u32).collect(), } } @@ -158,7 +159,6 @@ mod tests { KdNode::new_leaf(vec![]), ), ); - dbg!(&tree.root); assert_eq!(tree.root, expected); } }