[vtkusers] Densify points in Polydata?

Marc Huber marchuber.hft at gmx.de
Thu May 23 07:40:49 EDT 2013


Hi,

I have a Polydata object consisting of e.g. 8 points. I'd like to get 
more points on the object.
I tried it with a vtkPolyDataPointSampler.
This works fine with a sphere but it crashes with vtkPolyData.

Has anyone an idea what the problem might be? Or any alternative idea?
Thanks in advance!

Code:
//vtkSmartPointer<vtkSphereSource> sphereSource = 
vtkSmartPointer<vtkSphereSource>::New();
//    sphereSource->Update();
vtkSmartPointer<vtkPolyData> data = vtkSmartPointer<vtkPolyData>::New();
data->ShallowCopy(stlActor->GetMapper()->GetInputAsDataSet());
     data->Update();
vtkSmartPointer<vtkPolyDataPointSampler> pointSampler = 
vtkSmartPointer<vtkPolyDataPointSampler>::New();
             pointSampler->SetDistance(.1);
pointSampler->SetInputConnection(data->GetProducerPort());
/*pointSampler->SetInputConnection(sphereSource->GetOutputPort());*/
             pointSampler->Update(); //It crashes here
int numpoints=pointSampler->GetOutput()->GetNumberOfPoints();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130523/e75830ef/attachment.htm>


More information about the vtkusers mailing list