# IntersectWithLine potential bug

**URL:** <https://discourse.vtk.org/t/intersectwithline-potential-bug/11584>\
**Category:** Development\
**Created:** [May 31, 2023, 2:23pm UTC](https://discourse.vtk.org/t/intersectwithline-potential-bug/11584 "2023-05-31T14:23:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcomusy](https://discourse.vtk.org/user_avatar/discourse.vtk.org/marcomusy/32/95_2.png) [@marcomusy](https://discourse.vtk.org/u/marcomusy)\
**Post date:** [May 31, 2023, 2:23pm UTC](https://discourse.vtk.org/t/intersectwithline-potential-bug/11584/1 "2023-05-31T14:23:45Z")

</div>

The method seems to work well in general but not in this case when the polydata is the output of `vtkAppendPolyData`:

[circles.vtk](https://discourse.vtk.org/uploads/short-url/4ZOluSuDBDMWHavUmtk3b6rg7z1.vtk) (51.1 KB)

```py
import vtk

reader = vtk.vtkPolyDataReader()
reader.SetFileName("circles.vtk")
reader.Update()
polydata = reader.GetOutput()

line_locator = vtk.vtkOBBTree()
line_locator.SetDataSet(polydata)
#line_locator.SetTolerance(0.00000001)
line_locator.BuildLocator()

p0 = (0.22, -0.18, 3.1)
p1 = (-0.11, 0.6, -0.02)

vpts = vtk.vtkPoints()
idlist = vtk.vtkIdList()
line_locator.IntersectWithLine(p0, p1, vpts, idlist)
pts = []
for i in range(vpts.GetNumberOfPoints()):
    intersection = [0, 0, 0]
    vpts.GetPoint(i, intersection)
    pts.append(intersection)

print(pts)

#from vedo import *
#ccs = [Circle().z(i/3).rotate_x(i).triangulate() for i in range(10)]
#merge(ccs).write("circles.vtk")

```

Only the first hit is detected:

```auto
[[0.21073002 -0.15808912 3.01235652]]

```

![Screenshot from 2023-05-31 16-13-11](https://discourse.vtk.org/uploads/default/original/2X/d/dbad509ab1da3cf86e77e94bffcb322dc6d59bd4.png)
