# vtkStaticCellLocator throws error on IntersectWithLine

**URL:** https://discourse.vtk.org/t/vtkstaticcelllocator-throws-error-on-intersectwithline/5095
**Category:** Development
**Created:** [January 29, 2021, 7:21pm UTC](https://discourse.vtk.org/t/vtkstaticcelllocator-throws-error-on-intersectwithline/5095 "2021-01-29T19:21:16Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![DFlyer](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dflyer/32/1598_2.png) [@DFlyer](https://discourse.vtk.org/u/DFlyer)
#### Post date: [January 29, 2021, 7:21pm UTC](https://discourse.vtk.org/t/vtkstaticcelllocator-throws-error-on-intersectwithline/5095/1 "2021-01-29T19:21:16Z")

</div>

I am trying to intersect a polydata ( tri mesh) with a line, I am using vtkStaticCellLocator filter as follows

```
vtkSmartPointer< vtkStaticCellLocator> pCellLocator = vtkSmartPointer<vtkStaticCellLocator>::New();
pCellLocator->SetDataSet( polyData );
pCellLocator->BuildLocator();

vtkSmartPointer<vtkPoints> pPoints = vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkIdList> idlist = vtkSmartPointer<vtkIdList>::New();
pCellLocator->IntersectWithLine( fStartPoint, fEndPoint, pPoints, idlist );

```

Results the following error

> ERROR: In C:\VTK-9.0.1\Common\DataModel\vtkAbstractCellLocator.cxx, line 96  
> vtkStaticCellLocator (000001E8223F8BB0): The locator class - vtkStaticCellLocator does not yet support this IntersectWithLine interface

Thanks!

---

<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 29, 2021, 7:37pm UTC](https://discourse.vtk.org/t/vtkstaticcelllocator-throws-error-on-intersectwithline/5095/2 "2021-01-29T19:37:16Z")

</div>

It looks like someone implemented the specialized method IntersectWithLine( fStartPoint, fEndPoint, pPoints, idlist ) in one of the subclasses of vtkAbstractCellLocator, but did not also implement it in some of the other subclasses. Generally not a good idea, hopefully it wasn’t me 🙂

Look in vtkCellLocator / vtkStaticCellLocator. There are other versions of IntersectWithLine that are implemented e.g,

vtkCellLocator::IntersectWithLine(const double a0[3], const double a1[3], double tol, double& t,  
double x[3], double pcoords[3], int& subId, vtkIdType& cellId, vtkGenericCell\* cell)

If you are ambitious, add the missing IntersectWithLine to vtkCellLocator and/or vtkStaticCellLocator.
