[vtkusers] 3D point cloud nearest neighbor search

Benoist Laurent benoist at ibpc.fr
Thu Oct 14 04:43:37 EDT 2010


Hi,

A question related to the first one.
I also have a 3D point cloud and I'd like to pick some of these points.
Basically, I used a vtkKdTreePointLocator but the problem is that the  
distance between the cursor and the point takes into account the Z  
coordinates.
Therefore, the cursor seems nearest from another point than the one  
that was picked.

Any suggestion to look for the nearest neighbor taking into acount the  
X,Y coordinates?
I mean what's the proper way to do so?

Thanks,
Benoist


Le 12 oct. 10 à 15:58, G. Allegri a écrit :

> Thanks David, I will give it a try and I'll let you know.
>
> 2010/10/12 David Doria <daviddoria at gmail.com>:
>> On Tue, Oct 12, 2010 at 4:23 AM, G. Allegri <giohappy at gmail.com>  
>> wrote:
>>> Hello. I'm new to VTK and this list, so forgive my trivial  
>>> questions.
>>>
>>> I'm considering to use VTK to solve a conceptually simple problem,  
>>> but
>>> that require efficient 3D algorithms and data structures. I have a  
>>> csv
>>> file which represents a 3D grid of points (SET1). In this specific
>>> case their regularly spaced on the three axes, but the general case
>>> can be an irregular point cloud. The dataset is made of a couple of
>>> millions of points. I also have another set of 3D points (SET2). I
>>> need to set attributes in SET2 "sampling" the NN from SET1.
>>>
>>> I've chosen VTK having seen the various kd-tree and locator classes,
>>> but I wonder what is the most efficient way to achieve my goal, and
>>> what data structured is best for this. I'm considering vtkPolyData  
>>> or
>>> vtkUnstructuredGrid. What would you suggest for my datas and  
>>> problem?
>>> Are there efficient classes to read csv input streams to fill my  
>>> data
>>> structures?
>>>
>>> Thanks a lot,
>>> Giovanni
>>
>> You can modify this to read your csv file into a vtkPolyData:
>> http://www.vtk.org/Wiki/VTK/Examples/Cxx/InfoVis/ReadDelimitedFile
>>
>> Then build a vtkKdTreePointLocator to do the NN queries:
>> http://www.vtk.org/Wiki/VTK/Examples/Cxx/DataStructures/KdTreePointLocator/ClosestPoint
>>
>> Let us know if you have any trouble once you give it a shot.
>>
>> David
>>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>




More information about the vtkusers mailing list