[vtkusers] vtkPointLocator FindPointsWithinRadius Example

David Doria daviddoria+vtk at gmail.com
Wed Jan 27 12:19:24 EST 2010


On Wed, Jan 27, 2010 at 12:01 PM, KS Jothybasu <jothybasu at gmail.com> wrote:
> Hi all,
>
> Does anyone have an example for vtkPointLocator.FindPointsWithinRadius()
>
> I am having trouble with it, here is my code
>
> x=vtk.vtkSphereSource()
> x.SetRadius(50)
> x.SetPhiResolution(50)
> x.SetThetaResolution(50)
> x.Update()
>
>
>
> result=vtk.vtkIdList()
> Loc=vtk.vtkPointLocator()
> Loc.SetDataSet(x.GetOutput())
> Loc.FindPointsWithinRadius(25,[0,0,0],result)
>
> prints
> result None
>
> Any hint?
>
> I think using this vtkFindLocator/KDTree there should be some method to get
> the points inside a polygon of any shape?
>
> Thanks
>
> Jothy

I believe you may just have to call BuildLocator first. Here is an
example that works (c++, sorry):
http://www.vtk.org/Wiki/VTK/Examples/PointLocator_Radius

Thanks,

David



More information about the vtkusers mailing list