Forgot the pictures... Sorry for the spam.

Bertrand

 

De : Bertrand Gazanion [mailto:b.gazan...@gantha.com] 
Envoyé : jeudi 23 juin 2016 16:11
À : 'paraview@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

_______________________________________________
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 ParaView Wiki at: 
http://paraview.org/Wiki/ParaView

Search the list archives at: http://markmail.org/search/?q=ParaView

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview

Reply via email to