[vtkusers] vtkCellLocator, FindClosestPoint, python

Bryn Lloyd blloyd at vision.ee.ethz.ch
Thu Jun 12 12:33:03 EDT 2008


Hi,


I have a question about using vtkCellLocator in python.

How can I use the FindClosesPoint function?

I tried the following, but got the python error message
"AttributeError: FindClosestPoint".



reader = vtkPolyDataReader()
reader.SetFileName(fname)
reader.Update()
surface = reader.GetOutput()

clocator = vtkCellLocator()
clocator.SetDataSet(surface)
clocator.BuildLocator()

spoints = vtkStructuredPoints()
spoints.SetDimensions(10, 10, 10)

for nid in range(spoints.GetNumberOfPoints()):
	x = [0,0,0]
	spoints.GetPoint(nid, x)
	cp = [0,0,0]
	cid = 0
	subid = 0
	distance = 0.0
	clocator.FindClosestPoint(x, cp, cid, subid, distance)



Thanks for any help!

Cheers, Bryn






More information about the vtkusers mailing list