diff --git a/kdtree/src/lib.rs b/kdtree/src/lib.rs index e057b191..4b0c89bd 100644 --- a/kdtree/src/lib.rs +++ b/kdtree/src/lib.rs @@ -57,6 +57,7 @@ impl KdNode { Box::new(Self::Node { plane, left, right }) } + #[inline] pub fn is_empty(&self) -> bool { match self { Self::Leaf(indices) => indices.is_empty(), @@ -165,12 +166,14 @@ pub struct KdTree { } impl KdTree { + #[inline] pub fn iter_nodes(&self) -> KdTreeNodeIter<'_> { KdTreeNodeIter { stack: vec![(1, &self.root)], } } + #[inline] pub fn iter_leafs(&self) -> impl Iterator)> { self.iter_nodes().filter_map(|(depth, node)| match node { KdNode::Leaf(indices) => Some((depth, indices)), @@ -178,6 +181,7 @@ impl KdTree { }) } + #[inline] pub fn intersect( &self, ray: &Ray, diff --git a/kdtree/src/split.rs b/kdtree/src/split.rs index 869e3c81..1ac43311 100644 --- a/kdtree/src/split.rs +++ b/kdtree/src/split.rs @@ -15,7 +15,7 @@ pub(crate) fn clip_geometries(geometries: &[Geometry], cell: &KdCell) -> Vec<(u3 .collect::>() } -pub fn partition_triangles( +pub(crate) fn partition_triangles( clipped_triangles: &[(u32, Aabb)], plane: &Aap, ) -> (Vec, Vec, Vec) { @@ -42,7 +42,7 @@ pub fn partition_triangles( (left_triangles, middle_triangles, right_triangles) } -pub struct SplitPartitioning { +pub(crate) struct SplitPartitioning { pub left_aabb: Aabb, pub right_aabb: Aabb, pub left_indices: Vec, @@ -50,7 +50,11 @@ pub struct SplitPartitioning { pub right_indices: Vec, } -pub fn split_and_partition(clipped: &[(u32, Aabb)], aabb: &Aabb, plane: Aap) -> SplitPartitioning { +pub(crate) fn split_and_partition( + clipped: &[(u32, Aabb)], + aabb: &Aabb, + plane: Aap, +) -> SplitPartitioning { let (left_aabb, right_aabb) = aabb.split(&plane); let (left_indices, middle_indices, right_indices) = partition_triangles(clipped, &plane); SplitPartitioning {