[vtkusers] Densify points in Polydata?

David Doria daviddoria at gmail.com
Thu May 23 08:12:57 EDT 2013


On Thu, May 23, 2013 at 7:40 AM, Marc Huber <marchuber.hft at gmx.de> wrote:
> 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();

Can you upload your PolyData somewhere? vtkSphereSource->GetOutput()
is a vtkPolyData, so that isn't the problem.

David



More information about the vtkusers mailing list