Skip to content

Commit

Permalink
Fix accidentally remove boundary enlarging
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Oom committed Mar 16, 2024
1 parent d6a328d commit 64924fc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/kdtree/build_naive.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use nalgebra::vector;

use crate::{
geometry::{
aap::{Aap, Axis},
Expand Down Expand Up @@ -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(),
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/kdtree/build_sah.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use nalgebra::vector;
use rayon::prelude::*;

use crate::{
Expand Down Expand Up @@ -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(),
}
}
Expand Down Expand Up @@ -158,7 +159,6 @@ mod tests {
KdNode::new_leaf(vec![]),
),
);
dbg!(&tree.root);
assert_eq!(tree.root, expected);
}
}

0 comments on commit 64924fc

Please sign in to comment.