[vtkusers] problem with vtkPointLocator in insertion mode
Remi Blanc
rblanc33 at gmail.com
Sun Feb 27 12:48:12 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( myPolyData );
pointLocator->Update(); pointLocator->BuildLocator();
and my program (a variant of the Iterative Closest Points, and namely to identify correspondences between two vtkPoloData) was working perfectly well.
Now, I want to exclude some parts of the mesh from the pointLocator, for which I know no correspondences exist.
So I 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( myPolyData->GetPoint(listPts(i)) );
}
pointLocator->Update(); pointLocator->BuildLocator();
The code compiles and executes, but the rest of my program then completely fails. I did check the listPts has only valid point ids.
Actually, whenever I call pid = pointLocator->FindClosestPoint(p1), I receive absurd results (e.g. pid = 4294967295, or similar overflow-like value)
any hints?
Thanks
Remi
More information about the vtkusers
mailing list