# Minimum ray length during intersection test

**URL:** <https://discourse.vtk.org/t/minimum-ray-length-during-intersection-test/13031>\
**Category:** Support\
**Tags:** python\
**Created:** [January 8, 2024, 2:06pm UTC](https://discourse.vtk.org/t/minimum-ray-length-during-intersection-test/13031 "2024-01-08T14:06:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ehblackman](https://discourse.vtk.org/user_avatar/discourse.vtk.org/ehblackman/32/8238_2.png) [@ehblackman](https://discourse.vtk.org/u/ehblackman)\
**Post date:** [January 8, 2024, 2:06pm UTC](https://discourse.vtk.org/t/minimum-ray-length-during-intersection-test/13031/1 "2024-01-08T14:06:31Z")

</div>

Is there a minimum ray length used in VTK for intersection tests? My script involves generating a point within a 3d convex hull, and firing rays of different lengths from that point in random directions (vtkOBBTree.IntersectWithLine). This methods works fine and the intersection points are successfully identified and can be visualised along the ray EXCEPT when the ray length is set to =\<0.01. When ray length is equal to or less than 0.01, no intersection is ever declared, despite me being able to see in my visualisation that the ray does intersect the convex hull. This happens irrespective of the size of the convex hull.

The attached image shows an example of this, where a red point within the grey convex hull has 3 rays shooting outwards from it. Along the green and blue rays, intersections have been found and show the point with a yellow marker. The red ray however has a length of 0.01 and finds no intersection despite clearly intersecting the hull.

Any ideas? Thanks in advance.

 ![vtk_problem](https://discourse.vtk.org/uploads/default/original/2X/3/3502dc9b1cf7a27c3850ed6f0f3fad42643bae01.jpeg)

---

<div class="post-metadata">

**Author:** ![will.schroeder](https://discourse.vtk.org/user_avatar/discourse.vtk.org/will.schroeder/32/233_2.png) [@will.schroeder](https://discourse.vtk.org/u/will.schroeder)\
**Post date:** [January 9, 2024, 11:50am UTC](https://discourse.vtk.org/t/minimum-ray-length-during-intersection-test/13031/2 "2024-01-09T11:50:19Z")

</div>

After a quick perusal of the code, the only thing that strikes me is the Tolerance data member. You might play with this to see if it has any affect. Barring that, a pared down example would be helpful to determine what’s going on. (The class is in serious need of a makeover for performance reasons, style reasons, and thread safe reasons.)
