[vtkusers] vtkPointLocator Problem

A. Burak Yoldemir yoldemir at gmail.com
Thu Jun 10 14:28:18 EDT 2010


You are right Andy, it was my bad. Just a pointer-array confusion when
inserting points into vtkPoints object. It works fine now. Thanks for the
support.


- Ahmet Burak Yoldemir



On Thu, Jun 10, 2010 at 8:42 PM, Andy Bauer <andy.bauer at kitware.com> wrote:

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


More information about the vtkusers mailing list