From 6d5b557c156295d5033a8d0b34d549d44ca0ea49 Mon Sep 17 00:00:00 2001 From: Finn Bear Date: Fri, 10 Jan 2025 12:45:26 -0800 Subject: [PATCH] Docs #134 - acknowledge best-effort nature of dist traversal --- src/bvh/bvh_impl.rs | 6 ++++++ src/bvh/distance_traverse.rs | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/bvh/bvh_impl.rs b/src/bvh/bvh_impl.rs index 56ac53f..0cf95d4 100644 --- a/src/bvh/bvh_impl.rs +++ b/src/bvh/bvh_impl.rs @@ -133,6 +133,9 @@ impl Bvh { /// Returns a subset of [`shape`], in which the [`Aabb`]s of the elements were hit by [`Ray`]. /// Return in order from nearest to farthest for ray. /// + /// This is a best-effort function that orders interior parent nodes before ordering child + /// nodes, so the output is not necessarily perfectly sorted. + /// /// [`Bvh`]: struct.Bvh.html /// [`Aabb`]: ../aabb/struct.AABB.html /// @@ -148,6 +151,9 @@ impl Bvh { /// Returns a subset of [`Shape`], in which the [`Aabb`]s of the elements were hit by [`Ray`]. /// Return in order from farthest to nearest for ray. /// + /// This is a best-effort function that orders interior parent nodes before ordering child + /// nodes, so the output is not necessarily perfectly sorted. + /// /// [`Bvh`]: struct.Bvh.html /// [`Aabb`]: ../aabb/struct.AABB.html /// diff --git a/src/bvh/distance_traverse.rs b/src/bvh/distance_traverse.rs index 13c4ade..c402fbe 100644 --- a/src/bvh/distance_traverse.rs +++ b/src/bvh/distance_traverse.rs @@ -11,7 +11,10 @@ enum RestChild { } /// Iterator to traverse a [`Bvh`] in order from nearest [`Aabb`] to farthest for [`Ray`], -/// without memory allocations +/// or vice versa, without memory allocations. +/// +/// This is a best-effort iterator that orders interior parent nodes before ordering child +/// nodes, so the output is not necessarily perfectly sorted. pub struct DistanceTraverseIterator< 'bvh, 'shape,