[vtkusers] vtkPointInterpolator2D not interpolating

gde23 gdeee at web.de
Sun Feb 25 08:02:13 EST 2018


Hello,

i am trying to interpolate the z-value of points which are stored as P(x, y,
z) values in the format of vtkPolyData using VTK8.1.0 in c++.

Therefore i translated following  example
<https://www.vtk.org/gitweb?p=VTK.git;a=blob;f=Filters/Points/Testing/Python/TestPointInterpolator2D2.py>  
from pyhton to c++ (i haven't tested it using python)

    vtkNew<vtkDEMReader> demReader;
    demReader->SetFileName("/home/path/to/data/Data/SainteHelens.dem");
    demReader->Update();

    double bds[6];
    demReader->GetOutput()->GetBounds(bds);

    // Create a plane of onto which to map the elevation data
    vtkNew<vtkPlaneSource> plane;
    plane->SetResolution(200, 200);
    plane->SetOrigin(bds[0],bds[2],bds[4]);
    plane->SetPoint1(bds[1],bds[2],bds[4]);
    plane->SetPoint2(bds[0],bds[3],bds[4]);
    plane->Update();

    // # Gaussian
kernel-------------------------------------------------------
    vtkNew<vtkGaussianKernel> gaussianKernel;
    gaussianKernel->SetSharpness(2);
    gaussianKernel->SetRadius(200);

    vtkNew<vtkPointInterpolator2D> interp;
    interp->SetInputConnection(plane->GetOutputPort());
    interp->SetSourceConnection(demReader->GetOutputPort());
    interp->SetKernel(gaussianKernel);
    interp->SetNullPointsStrategyToClosestPoint();
    interp->InterpolateZOff();
    interp->Update();

    vtkSmartPointer<vtkPolyData> interpolated_poly_data =
interp->GetPolyDataOutput();

after that i visualize the interpolated_poly_data with the same pipeline i
use to plot other stuff.

However the output of the vtkPointInterpolator2D is always the same as what
was set in SetInputConnection() or SetInputData() (in this example just a
plane)
The SetSourceConnection() / SetSourceData() that should be interpolated
doesn't have any effect on the output at all.

I also have played around with different types of kernels as well as
different settings for 
NullPointsStrategy and InterpolateZ off/on.

What am i missing or where is the error?
 



--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html


More information about the vtkusers mailing list