warp.mesh_query_ray_count_intersections#
- warp.mesh_query_ray_count_intersections( ) int#
Kernel
Count the number of intersections between a ray and a
warp.Mesh. Returns the number of intersections (with t >= 0) between the ray and the mesh.This function casts a ray through the mesh and counts all triangle intersections with
t >= 0. Unlikemesh_query_ray(), this function does not stop at the first hit and continues traversing to count all intersections along the entire ray.This function can be used to determine whether the ray origin lies inside a watertight, intersection-free mesh. An odd number of intersections indicates the origin is inside the mesh, while an even number indicates it is outside.
The
rootparameter can be obtained using themesh_get_group_root()function when creating a grouped mesh. Whenrootis a valid (>=0) value, the traversal will be confined to the subtree starting from the root. Ifrootis -1 (default), traversal starts at the mesh’s global root.- param id:
The mesh identifier
- param start:
The start point of the ray
- param dir:
The ray direction (should be normalized)
- param root:
The root node index for grouped BVH queries, or -1 for global root (optional, default: -1)