[Paraview] Find points within radius

Bertrand Gazanion b.gazanion at gantha.com
Thu Jun 23 10:13:16 EDT 2016


Forgot the pictures... Sorry for the spam.

Bertrand

 

De : Bertrand Gazanion [mailto:b.gazanion at gantha.com] 
Envoyé : jeudi 23 juin 2016 16:11
À : 'paraview at paraview.org'
Objet : Find points within radius

 

On behalf of a colleague of mine working with ParaView 4.3.1

 

Hello,


I am using an algorithm doing calculation on points and their neighbours and
I find the results of those points locators to be strange. To test it I made
a simple algorithm counting how many neighbours each point has.
When I create a plane and set its x and y resolution to 100 each, all points
should have the same number of neighbours except on the sides. However
vtkPointLocator, vtkKdTreePointLocator and vtkOctreePointLocator do not find
the same number of neighbours for each point.

Here is the algorithm that I use to get the number of neighbors each points
has :
import vtk

pdi = self.GetInputDataObject(0,0)
nb_pts = pdi.GetNumberOfPoints()

# Point locator
loc = vtk.vtkPointLocator()
#loc = vtk.vtkOctreePointLocator()
#loc = vtk. vtkKdTreePointLocator()

loc.SetDataSet(pdi)
loc.BuildLocator()

pts = pdi.GetPoints()

neighbours = vtk.vtkTypeInt64Array()
neighbours.SetNumberOfComponents(1)
neighbours.SetNumberOfTuples(nb_pts)
neighbours.SetName('neighbours')

for k in range(nb_pts):

    xp = pdi.GetPoint(k)

    id_list = vtk.vtkIdList()

    loc.FindPointsWithinRadius(0.01,xp,id_list)
    loc.Update()

    N = id_list.GetNumberOfIds()
    neighbours.InsertTuple1(k,N)


self.GetOutput().GetPointData().AddArray(neighbours)

 

You will find attached sample picture describing the result I get with each
point locator.

thank you very much

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20160623/c5174453/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vtkPointLocator.png
Type: image/png
Size: 27606 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/paraview/attachments/20160623/c5174453/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vtkKdTreePointLocator.png
Type: image/png
Size: 27709 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/paraview/attachments/20160623/c5174453/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vtkOctreePointLocator.png
Type: image/png
Size: 24031 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/paraview/attachments/20160623/c5174453/attachment-0002.png>


More information about the ParaView mailing list