title: Vtk check if polydata objects intersect
body: <p>I'm trying to bring 2 vtkPolyData objects closer to each other without them intersecting. I would like to "test" if one is inside the other with a simple boolean function. My first thought was to use vtkBooleanOperationPolyDataFilter with the datasets as inputs and calculate the intersection and then check if the resulting PolyData object was a NULL object. This however, does not give the desired result.</p>
  
  <p>The code I'm currently using looks like this:</p>
  
  <pre><code>bool Main::Intersect(double *trans)
  {
      vtkSmartPointer&lt;vtkPolyData&gt; data1 = vtkSmartPointer&lt;vtkPolyData&gt;::New();
      vtkSmartPointer&lt;vtkPolyData&gt; data2 = vtkSmartPointer&lt;vtkPolyData&gt;::New();
      data1-&gt;ShallowCopy(this-&gt;ICPSource1);
      data2-&gt;ShallowCopy(this-&gt;ICPSource2);
  
      //This piece is just to reposition the data to the position I want to check
  
      for (unsigned int k=0; k&lt;3; k++)
      {
          trans[k]/=2;
      }
  
  
      translate(data2, trans);
  
      for (unsigned int k=0; k&lt;3; k++)
      {
          trans[k]*=-1;
      }
  
      translate(data1, trans);
  
      //This is my use of the actual vtkBooleanOperationPolyDataFilter class
  
      vtkSmartPointer&lt;vtkBooleanOperationPolyDataFilter&gt; booloperator = vtkSmartPointer&lt;vtkBooleanOperationPolyDataFilter&gt;::New();
      booloperator-&gt;SetOperationToIntersection();
      booloperator-&gt;AddInputData(data1);
      booloperator-&gt;AddInputData(data2);
      booloperator-&gt;Update();
  
      if (booloperator-&gt;GetOutput()==NULL)
          return 0;
      else
          return 1;
  
  }
  </code></pre>
  
  <p>Any help regarding this issue is highly appreciated. Also, I don't know if the "vtkBooleanOperationPolyDataFilter" class is really the best one to use, it's just something I found and thought might work.</p>
  
  <p>Thanks in advance,
  Xentro</p>
  
  <p>EDIT: I said this doesn't give the desired result but it does improve my result. It has some kind of influence on my movement criterion (which was the point) but in the end result the datasets still intersect sometimes.</p>