[vtkusers] how to call vtkKdTree::FindClosestPoint from python?

Elvis Chen elvis.chen at gmail.com
Mon Apr 12 12:05:04 EDT 2010


Greetings,

Can someone please shed some lights into what is the correct syntax in
calling vtkKdTree::FindClosestPoint from python:


>>> import os, sys, math, vtk
>>> points = vtk.vtkPoints()
>>> points.InsertNextPoint( 0, 0, 0 )
0
>>> points.InsertNextPoint( 1, 0, 0 )
1
>>> points.InsertNextPoint( 1, 1, 0 )
2
>>> points.InsertNextPoint( 0, 1, 0 )
3
>>> kd = vtk.vtkKdTree()
>>> kd.BuildLocatorFromPoints( points )
>>> kd.FindPoint( 1, 1, 0 )
2
>>> dist = 0.0
>>> kd.FindClosestPoint( 0, 0, 0, dist )
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: FindClosestPoint


Thanks,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100412/1c3f1cbb/attachment.htm>


More information about the vtkusers mailing list