diff --git a/docs/modules/runtime.rst b/docs/modules/runtime.rst index b6d1a46e6..2151bcf57 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") @@ -1156,15 +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 fully contained -within 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 @@ -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 at this 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")