[vtkusers] vtkPolyDataPointSampler doesn't work .. Whats wrong in the code?

rakesh patil prakeshofficial at gmail.com
Tue Mar 1 03:53:38 EST 2011


Hello,

I have an unstructured grid. And what I want to do is get the points
seperated by a specific distance along x and y axis.

http://www.vtk.org/doc/nightly/html/classvtkPolyDataPointSampler.html

says that *"**vtkPolyDataPointSampler** generates points from input **
vtkPolyData**. The points are placed approximately a specified distance
apart."*
**
So what I did was, I converted the unstructured grid to a polydata, using
vtkGeometryFilter as shown below:

vtkSmartPointer<vtkGeometryFilter> gf =
vtkSmartPointer<vtkGeometryFilter>::New();
gf->SetInput(ugrid);

vtkSmartPointer<vtkPolyDataPointSampler> pds =
vtkSmartPointer<vtkPolyDataPointSampler>::New();
pds->SetInputConnection( gf->GetOutputPort());
pds->SetDistance(0.8);
pds->Update();

vtkSmartPointer<vtkPolyDataMapper> mapp =
vtkSmartPointer<vtkPolyDataMapper>::New();
mapp->SetInputConnection( pds->GetOutputPort());

... /* Create an actor and add it to the renderer */

Now the thing is in my test case data, the total number of node points in
unstructured grid is say, 61,240. Even after sampling it produces the same
number of points. I was expecting it to reduce the number of points. And if
I decrease the distance, the number of points increases and also the
distance between two successive points are not same.

Can any one tell where I've gone wrong? Or whether my understanding of the
use of vtkPolyDataPointSampler is not correct?

Thanks in advance

Regards

Rakesh Patil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110301/ac67f811/attachment.htm>


More information about the vtkusers mailing list