From 1770c2c8a47a75d17575909468648bf7658d60e9 Mon Sep 17 00:00:00 2001 From: Miles Macklin Date: Mon, 2 Sep 2024 12:18:38 +1200 Subject: [PATCH 1/4] Fix BVH ray query docs --- docs/modules/runtime.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/modules/runtime.rst b/docs/modules/runtime.rst index b6d1a46e6..84623157d 100644 --- a/docs/modules/runtime.rst +++ b/docs/modules/runtime.rst @@ -1135,11 +1135,11 @@ An example of performing a ray traversal on the data structure is as follows: bounds_intersected: wp.array(dtype=wp.bool), ): query = wp.bvh_query_ray(bvh_id, start, dir) - bounds_nr = wp.int32(0) + index = wp.int32(0) - while wp.bvh_query_next(query, bounds_nr): - # The ray intersects the volume with index bounds_nr - bounds_intersected[bounds_nr] = True + while wp.bvh_query_next(query, index): + # The ray intersects the bounds of the item at this index + bounds_intersected[index] = True bounds_intersected = wp.zeros(shape=(num_bounds), dtype=wp.bool, device="cuda:0") From f01404dca2a3050088959f4940e691a50a1a2f94 Mon Sep 17 00:00:00 2001 From: Miles Macklin Date: Mon, 2 Sep 2024 12:21:06 +1200 Subject: [PATCH 2/4] Update volume query --- docs/modules/runtime.rst | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/docs/modules/runtime.rst b/docs/modules/runtime.rst index 84623157d..0486847b2 100644 --- a/docs/modules/runtime.rst +++ b/docs/modules/runtime.rst @@ -1163,8 +1163,7 @@ which returns ``True`` as long as there are intersecting bounds. Example: BVH Volume Traversal ############################# -Similar to the ray-traversal example, we can perform volume traversal to find the volumes that are fully contained -within a specified bounding box. +Similar to the ray-traversal example, we can perform volume traversal to find the volumes that are intersect a specified bounding box. .. code:: python @@ -1176,12 +1175,12 @@ within a specified bounding box. bounds_intersected: wp.array(dtype=wp.bool), ): query = wp.bvh_query_aabb(bvh_id, lower, upper) - bounds_nr = wp.int32(0) + index = wp.int32(0) - while wp.bvh_query_next(query, bounds_nr): - # The volume with index bounds_nr is fully contained - # in the (lower,upper) bounding box - bounds_intersected[bounds_nr] = True + while wp.bvh_query_next(query, index): + # The volume with index intersects + # with the (lower,upper) bounding box + bounds_intersected[index] = True bounds_intersected = wp.zeros(shape=(num_bounds), dtype=wp.bool, device="cuda:0") From d1c1c7c1655909b81b0133b92246d7984b6a09d1 Mon Sep 17 00:00:00 2001 From: Miles Macklin Date: Mon, 2 Sep 2024 12:21:51 +1200 Subject: [PATCH 3/4] Update runtime.rst --- docs/modules/runtime.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/modules/runtime.rst b/docs/modules/runtime.rst index 0486847b2..57f1b1556 100644 --- a/docs/modules/runtime.rst +++ b/docs/modules/runtime.rst @@ -1178,7 +1178,7 @@ Similar to the ray-traversal example, we can perform volume traversal to find th index = wp.int32(0) while wp.bvh_query_next(query, index): - # The volume with index intersects + # The volume at this index intersects # with the (lower,upper) bounding box bounds_intersected[index] = True From 5b8c6285c1aabbb65647a69a0dcd4f8af00f24ab Mon Sep 17 00:00:00 2001 From: Miles Macklin Date: Mon, 2 Sep 2024 12:23:50 +1200 Subject: [PATCH 4/4] Update runtime.rst --- docs/modules/runtime.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/modules/runtime.rst b/docs/modules/runtime.rst index 57f1b1556..2151bcf57 100644 --- a/docs/modules/runtime.rst +++ b/docs/modules/runtime.rst @@ -1156,14 +1156,14 @@ An example of performing a ray traversal on the data structure is as follows: The Warp kernel ``bvh_query_ray`` is launched with a single thread, provided the unique :class:`uint64` identifier of the :class:`wp.Bvh ` object, parameters describing the ray, and an array to store the results. In ``bvh_query_ray``, :func:`wp.bvh_query_ray() ` is called once to obtain an object that is stored in the -variable ``query``. An integer is also allocated as ``bounds_nr`` to store the volume index of the traversal. +variable ``query``. An integer is also allocated as ``index`` to store the volume index of the traversal. A while statement is used for the actual traversal using :func:`wp.bvh_query_next() `, which returns ``True`` as long as there are intersecting bounds. Example: BVH Volume Traversal ############################# -Similar to the ray-traversal example, we can perform volume traversal to find the volumes that are intersect a specified bounding box. +Similar to the ray-traversal example, we can perform volume traversal to find the leaf nodes that are intersecting a specified bounding box. .. code:: python