It works for my python script:<br><br>from vtk import *<br>s = vtkSphereSource()<br>s.SetPhiResolution(40)<br>s.Update()<br>pd = s.GetOutput()<br>pd.GetNumberOfPoints()<br>loc = vtkPointLocator()<br>loc.SetDataSet(pd)<br>id = vtkIdList()<br>
pt = [0,0,0]<br>loc.FindPointsWithinRadius(5, pt, id)<br>id.GetNumberOfIds()<br>pd.GetNumberOfPoints()<br><br><br>What version of vtk are you using?  If you send me a test code that fails with a data set I&#39;ll check it out.<br>
<br>Andy<br><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
Date: Wed, 9 Jun 2010 23:50:08 +0300<br>
From: &quot;A. Burak Yoldemir&quot; &lt;<a href="mailto:yoldemir@gmail.com">yoldemir@gmail.com</a>&gt;<br>
Subject: Re: [vtkusers] vtkPointLocator Problem<br>
To: Bill Lorensen &lt;<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>&gt;, <a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a><br>
Message-ID:<br>
        &lt;<a href="mailto:AANLkTikyCw5WIypHmpkjkZgnroGkfmtcij5R7_AaGFa4@mail.gmail.com">AANLkTikyCw5WIypHmpkjkZgnroGkfmtcij5R7_AaGFa4@mail.gmail.com</a>&gt;<br>
Content-Type: text/plain; charset=&quot;iso-8859-1&quot;<br>
<br>
Yes, I am aware of that example, but I have no solution to my problem. What<br>
I want is to use a vtkPolyData object as the dataset of a vtkPointLocator.<br>
Here is my problem in a nutshell:<br>
<br>
- I have a number of points in a vtkPoints object.<br>
- Then, I create a vtkPolyData object and use the SetPoints function of it<br>
to define the point coordinates.<br>
- Next, I create a vtkPointLocator object and use the SetDataSet function of<br>
it to build the locator from these points.<br>
- Finally, I use FindPointsWithinRadius function for a point which has many<br>
neighbors (just manually checked), but no neighbors are returned.<br>
- I also tried FindClosestPoint function for each of my points. At each<br>
time, the closest point ID turns out to be 0, however it actually is not.<br>
<br>
What might I be missing?<br>
<br>
<br>
- Ahmet Burak Yoldemir<br>
<br>
<br>
On Wed, Jun 9, 2010 at 1:04 AM, Bill Lorensen &lt;<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>&gt;wrote:<br>
<br>
&gt; Have you looked at this example:<br>
&gt; <a href="http://www.vtk.org/Wiki/VTK/Examples/PointLocator_Radius" target="_blank">http://www.vtk.org/Wiki/VTK/Examples/PointLocator_Radius</a><br>
&gt;<br>
&gt;<br>
&gt; On Tue, Jun 8, 2010 at 4:49 PM, A. Burak Yoldemir &lt;<a href="mailto:yoldemir@gmail.com">yoldemir@gmail.com</a>&gt;<br>
&gt; wrote:<br>
&gt; &gt; Hello all,<br>
&gt; &gt;<br>
&gt; &gt; I am having a problem with FindPointsWithinRadius function of<br>
&gt; &gt; vtkPointLocator class. I have a bunch of points in a certain volume, with<br>
&gt; no<br>
&gt; &gt; specific topology. Using the following code snippet, I create a point<br>
&gt; &gt; locator object and specify its data set:<br>
&gt; &gt;<br>
&gt; &gt; vtkPoints* edge_pts = vtkPoints::New();<br>
&gt; &gt;<br>
&gt; &gt; for(int i = 0; i &lt; someLimit; i++)<br>
&gt; &gt;<br>
&gt; &gt; {<br>
&gt; &gt;<br>
&gt; &gt; edge_pts-&gt;InsertNextPoint(somePoint);<br>
&gt; &gt;<br>
&gt; &gt; }<br>
&gt; &gt;<br>
&gt; &gt; vtkPolyData* edge_pts_set = vtkPolyData::New();<br>
&gt; &gt;<br>
&gt; &gt; edge_pts_set-&gt;SetPoints(edge_pts);<br>
&gt; &gt;<br>
&gt; &gt; edge_pts_set-&gt;Update();<br>
&gt; &gt;<br>
&gt; &gt; vtkPointLocator* NeighborLocator = vtkPointLocator::New();<br>
&gt; &gt;<br>
&gt; &gt; NeighborLocator-&gt;SetDataSet(edge_pts_set);<br>
&gt; &gt;<br>
&gt; &gt; NeighborLocator-&gt;BuildLocator();<br>
&gt; &gt;<br>
&gt; &gt; Then, I use the FindPointsWithinRadius function of NeighborLocator, where<br>
&gt; I<br>
&gt; &gt; (manually) made sure that there are several neighbors of the query point.<br>
&gt; &gt; However, the aforementioned function returns no neighbors. Any ideas on<br>
&gt; &gt; where the problem could be?<br>
&gt; &gt;<br>
&gt; &gt; Regards,<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; Burak<br></blockquote></div><br>