[vtkusers] vtkPointLocator using Insertion

Remi Blanc rblanc33 at gmail.com
Fri Feb 25 03:25:45 EST 2011


for some reason, "/" symbols appeared around code inserts in my last mail.
nothing is commented out in my code.

Le 25/02/2011 00:37, Remi Blanc a écrit :
> 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/51f61f5a/attachment.htm>


More information about the vtkusers mailing list