<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body text="#000000" bgcolor="#ffffff">
    Hi all,<br>
    <br>
    I have problems using vtkPointLocator&nbsp; in insertion mode.<br>
    Initially, I was using succesfully a code looking like:<br>
    <br>
    <i>vtkSmartPointer&lt;vtkPointLocator&gt; pointLocator =
      vtkSmartPointer&lt;vtkPointLocator&gt;::New();<br>
      pointLocator-&gt;SetDataSet( myVTKPolyData );<br>
      pointLocator-&gt;Update();&nbsp;&nbsp;&nbsp; pointLocator-&gt;BuildLocator();<br>
    </i><br>
    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)<br>
    Now, I need to exclude some parts of the mesh from the pointLocator,
    and looked at the -&gt;InsertNextPoint( ) method.<br>
    My code now looks like:<br>
    <br>
    <i>vtkSmartPointer&lt;vtkPointLocator&gt; pointLocator =
      vtkSmartPointer&lt;vtkPointLocator&gt;::New();<br>
      vtkSmartPointer&lt;vtkPoints&gt; tmpPts =
      vtkSmartPointer&lt;vtkPoints&gt;::New();<br>
    </i><i>pointLocator-&gt;InitPointInsertion(tmpPts, bounds);<br>
      for (int i=0 ; i&lt;listPts.size() ; i++) {<br>
      &nbsp;&nbsp;&nbsp; pointLocator-&gt;InsertNextPoint( tmpmyVTKPolyData
      mesh-&gt;GetPoint(listPts(i)) );<br>
      }<br>
      pointLocator-&gt;Update();&nbsp;&nbsp;&nbsp; pointLocator-&gt;BuildLocator();<br>
    </i>
    <br>
    The code executes, but the rest of my program then completely fails.
    I did check the <i>listPts</i> has only valid point ids.<br>
    Whenever I call&nbsp; <i>pid = pointLocator-&gt;FindClosestPoint(p1)</i>,
    I receive absurd results (e.g. pid = 4294967295, or similar
    overflow-like value)<br>
    <br>
    any hints?<br>
    Thanks <br>
    Remi<br>
  </body>
</html>