Skip to content

Commit 0bc8ab1

Browse files
authored
Merge pull request #135 from finnbear/docs_134
Docs #134 - acknowledge best-effort nature of dist traversal
2 parents 23cb5fe + 1ad8e38 commit 0bc8ab1

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
2020
- Fix some assertions [#129](https://github.com/svenstaro/bvh/pull/129) (thanks @finnbear)
2121
- Fix traversal in case of single-node BVH [#130](https://github.com/svenstaro/bvh/pull/130) (thanks @finnbear)
2222
- Fix intersection between rays and AABBs that lack depth. [#131](https://github.com/svenstaro/bvh/pull/131) (thanks @finnbear)
23+
- Document the limitations of distance traversal best-effort ordering. [#135](https://github.com/svenstaro/bvh/pull/135) (thanks @finnbear)
2324

2425
## 0.10.0 - 2024-07-06
2526
- Don't panic when traversing empty BVH [#106](https://github.com/svenstaro/bvh/pull/106) (thanks @finnbear)

src/bvh/bvh_impl.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ impl<T: BHValue, const D: usize> Bvh<T, D> {
133133
/// Returns a subset of [`shape`], in which the [`Aabb`]s of the elements were hit by [`Ray`].
134134
/// Return in order from nearest to farthest for ray.
135135
///
136+
/// This is a best-effort function that orders interior parent nodes before ordering child
137+
/// nodes, so the output is not necessarily perfectly sorted.
138+
///
136139
/// [`Bvh`]: struct.Bvh.html
137140
/// [`Aabb`]: ../aabb/struct.AABB.html
138141
///
@@ -148,6 +151,9 @@ impl<T: BHValue, const D: usize> Bvh<T, D> {
148151
/// Returns a subset of [`Shape`], in which the [`Aabb`]s of the elements were hit by [`Ray`].
149152
/// Return in order from farthest to nearest for ray.
150153
///
154+
/// This is a best-effort function that orders interior parent nodes before ordering child
155+
/// nodes, so the output is not necessarily perfectly sorted.
156+
///
151157
/// [`Bvh`]: struct.Bvh.html
152158
/// [`Aabb`]: ../aabb/struct.AABB.html
153159
///

src/bvh/distance_traverse.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ enum RestChild {
1111
}
1212

1313
/// Iterator to traverse a [`Bvh`] in order from nearest [`Aabb`] to farthest for [`Ray`],
14-
/// without memory allocations
14+
/// or vice versa, without memory allocations.
15+
///
16+
/// This is a best-effort iterator that orders interior parent nodes before ordering child
17+
/// nodes, so the output is not necessarily perfectly sorted.
1518
pub struct DistanceTraverseIterator<
1619
'bvh,
1720
'shape,

0 commit comments

Comments
 (0)