[vtkusers] method to remove points in a polydata

nuno.jf nunofernandes7 at gmail.com
Thu Jun 23 09:13:39 EDT 2011


Hi David, thank you for your help.
I used the example you had shown me, and changed it to read a polydata and
use it as input the methods described: 

 //Read a polydata
	vtkPolyDataReader * imp = vtkPolyDataReader::New();
	imp -> SetFileName(argv[1]);
	imp -> Update();

    //Create the tree
  vtkSmartPointer<vtkKdTreePointLocator> pointTree = 
      vtkSmartPointer<vtkKdTreePointLocator>::New();
  pointTree->SetDataSet(imp->GetOutput());
  pointTree->BuildLocator();
 
  // Find the k closest points to (0,0,0)
   int k = 1;
  double testPoint[3] = {0.0, 0.0, 0.0};
  vtkSmartPointer<vtkIdList> result = 
      vtkSmartPointer<vtkIdList>::New();
 
  pointTree->FindPointsWithinRadius(5.0, testPoint, result);
 
  for(vtkIdType i = 0; i < k; i++)
    {
    vtkIdType point_ind = result->GetId(i);
    double p[3];
    imp->GetOutput()->GetPoint(point_ind, p);
    std::cout << "Closest point " << i << ": Point "
        << point_ind << ": (" << p[0] << ", " << p[1] << ", " << p[2] << ")"
<< std::endl;
    }

The problem is that the application stops responding and I got nothing in
the output. Could you please help me to see what is wrong? What I need to do
is to create a new polydata and set the resulting points as its input
points.


--
View this message in context: http://vtk.1045678.n5.nabble.com/method-to-remove-points-in-a-polydata-tp4510332p4517399.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list