mymesh.rays.RayBoxesIntersection#

mymesh.rays.RayBoxesIntersection(pt, ray, xlims, ylims, zlims)[source]#

Vectorized intersection algorithm for detecting intersections between a ray and a set of axis-aligned boxes. Williams, A., Barrus, S., Morley, R. K., & Shirley, P. (2005). An efficient and robust ray-box intersection algorithm. ACM SIGGRAPH 2005 Courses, SIGGRAPH 2005, 10(1), 55-60. https://www.doi.org/10.1145/1198555.1198748 [WBMS05]

Parameters:
  • pt (array_like) – 3D coordinates for the starting point of the ray.

  • ray (array_like) – 3D vector of ray direction. This should, in general, be a unit vector.

  • xlims (array_like) – 2D array_like with the upper and lower x-direction bounds for each axis-aligned box. Should have shape (n,2).

  • ylims (array_like) – 2D array_like with the upper and lower y-direction bounds for each axis-aligned box. Should have shape (n,2).

  • zlims (array_like) – 2D array_like with the upper and lower z-direction bounds for each axis-aligned box. Should have shape (n,2).

Returns:

intersections – Array of booleans, True if there is an intersection between the ray and the box, otherwise False.

Return type:

np.ndarray()