warp.tile\_mesh\_query\_aabb ============================ .. currentmodule:: warp._src.lang .. function:: tile_mesh_query_aabb(id: uint64, low: vec3f, high: vec3f) -> MeshQueryAABBTiled .. wp-function-tags:: :kernel: true :python: false :differentiable: false Construct an axis-aligned bounding box query against a :class:`warp.Mesh` for thread-block parallel traversal. The whole block traverses one query cooperatively. Advance it with :func:`~warp.tile_mesh_query_aabb_next`, which hands every thread one face index per step in unspecified order. Guard the traversal loop with :func:`~warp.tile_query_valid`. This is a broad-phase test on bounding boxes: a reported face's triangle may not actually intersect the box, so perform an exact test yourself if required. Only one mesh query may be active per block; exhaust it before constructing another. :param id: The mesh identifier (must be the same for all threads in the block) :param low: The lower bound of the query box, in the mesh's local space (must be the same for all threads in the block) :param high: The upper bound of the query box, in the mesh's local space (must be the same for all threads in the block) :returns: A :class:`warp.MeshQueryAABBTiled` to advance with :func:`~warp.tile_mesh_query_aabb_next`. .. rubric:: Example .. testcode:: @wp.kernel def overlapping_faces(mesh_id: wp.uint64, lo: wp.vec3, hi: wp.vec3, counts: wp.array[wp.int32]): query = wp.tile_mesh_query_aabb(mesh_id, lo, hi) while wp.tile_query_valid(query): # one face index per thread, negative where this thread has no result face = wp.untile(wp.tile_mesh_query_aabb_next(query)) if face >= 0: wp.atomic_add(counts, face, 1) points = wp.array([[0, 0, 0], [1, 0, 0], [0, 1, 0], [2, 0, 0], [3, 0, 0], [2, 1, 0]], dtype=wp.vec3) indices = wp.array([0, 1, 2, 3, 4, 5], dtype=wp.int32) mesh = wp.Mesh(points=points, indices=indices) counts = wp.zeros(2, dtype=wp.int32) wp.launch_tiled(overlapping_faces, dim=1, inputs=[mesh.id, wp.vec3(-1.0, -1.0, -1.0), wp.vec3(0.5, 2.0, 1.0)], outputs=[counts], block_dim=4) print("times each face was reported:", counts.numpy().tolist()) .. testoutput:: times each face was reported: [1, 0]