[vtkusers] Densify points in Polydata?

Marc Huber marchuber.hft at gmx.de
Thu May 23 08:35:59 EDT 2013


Am 5/23/2013 2:12 PM, schrieb David Doria:
> 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
>
It is very small so I can directly append it. I hope this is ok.
It doesn't work with both datasets.
A visualization works fine.
I also append a screenshot of the error.

Best regards
Marc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: polydata.stl
Type: application/octet-stream
Size: 684 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130523/adc0a2ef/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: polydata2.stl
Type: application/octet-stream
Size: 7084 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130523/adc0a2ef/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: error.JPG
Type: image/jpeg
Size: 26168 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130523/adc0a2ef/attachment.jpeg>


More information about the vtkusers mailing list