[vtkusers] vtkPointLocator using Insertion

Remi Blanc rblanc33 at gmail.com
Thu Feb 24 18:37:13 EST 2011


Hi all,

I have problems using vtkPointLocator  in insertion mode.
Initially, I was using succesfully a code looking like:

/vtkSmartPointer<vtkPointLocator> pointLocator = 
vtkSmartPointer<vtkPointLocator>::New();
pointLocator->SetDataSet( myVTKPolyData );
pointLocator->Update();    pointLocator->BuildLocator();
/
and my program was working perfectly well (the aim is to implement a 
variant of the Iterative Closest Points, and namely to identify 
correspondences between two vtkPolyData)
Now, I need to exclude some parts of the mesh from the pointLocator, and 
looked at the ->InsertNextPoint( ) method.
My code now looks like:

/vtkSmartPointer<vtkPointLocator> pointLocator = 
vtkSmartPointer<vtkPointLocator>::New();
vtkSmartPointer<vtkPoints> tmpPts = vtkSmartPointer<vtkPoints>::New();
//pointLocator->InitPointInsertion(tmpPts, bounds);
for (int i=0 ; i<listPts.size() ; i++) {
     pointLocator->InsertNextPoint( tmpmyVTKPolyData 
mesh->GetPoint(listPts(i)) );
}
pointLocator->Update();    pointLocator->BuildLocator();
/
The code executes, but the rest of my program then completely fails. I 
did check the /listPts/ has only valid point ids.
Whenever I call /pid = pointLocator->FindClosestPoint(p1)/, I receive 
absurd results (e.g. pid = 4294967295, or similar overflow-like value)

any hints?
Thanks
Remi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110225/8cbba15c/attachment.htm>


More information about the vtkusers mailing list