# Updating vtkPointInterpolator

**URL:** https://discourse.vtk.org/t/updating-vtkpointinterpolator/2657
**Category:** Support
**Created:** [February 19, 2020, 1:46pm UTC](https://discourse.vtk.org/t/updating-vtkpointinterpolator/2657 "2020-02-19T13:46:50Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![michael23](https://discourse.vtk.org/user_avatar/discourse.vtk.org/michael23/32/837_2.png) [@michael23](https://discourse.vtk.org/u/michael23)
#### Post date: [February 19, 2020, 1:46pm UTC](https://discourse.vtk.org/t/updating-vtkpointinterpolator/2657/1 "2020-02-19T13:46:50Z")

</div>

Hi,

I am using the vtkPointInterpolator to interpolate the scalars of some points onto a surface.

```
vtkSmartPointer<vtkDoubleArray> scalars = vtkSmartPointer<vtkDoubleArray>::New();
scalars->SetName("sca");
scalars->SetNumberOfTuples(100);

for (int i = 0; i < 100; i ++)
{
 scalars ->SetTuple1(i, static_cast<float>(rand()) /static_cast<float>(RAND_MAX)*5.0);
}

vtkSmartPointer<vtkPolyData> pd = vtkSmartPointer<vtkPolyData>::New();
pd->SetPoints(POINTS); // 100 points
pd->GetPointData()->SetScalars(scalars);
pd->GetPointData()->SetActiveScalars("sca");

vtkSmartPointer<vtkGaussianKernel> kernel = vtkSmartPointer<vtkGaussianKernel>::New();
kernel->SetSharpness(2);
kernel->SetRadius(25);

vtkSmartPointer<vtkPointInterpolator> point_interpolator = vtkSmartPointer<vtkPointInterpolator>::New();
point_interpolator->SetInputData(surface->GetPolyData());
point_interpolator->SetSourceData(pd);
point_interpolator->SetKernel(kernel);
point_interpolator->SetNullPointsStrategyToNullValue();
point_interpolator->Update();

surface->GetPolyData()->GetPointData()->GetScalars()->DeepCopy(point_interpolator->GetOutput()->GetPointData()->GetScalars());

```

I am running this code in a loop whereby the scalar values change. Nevertheless, vtkPointInterpolator always outputs the interpolated scalars which correspond to the first run.

Can someone explain me how to update this filter in order to perform a periodic interpolation?

Thank you.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [February 26, 2020, 12:13pm UTC](https://discourse.vtk.org/t/updating-vtkpointinterpolator/2657/2 "2020-02-26T12:13:46Z")

</div>

Is it possible to include the loop you mentioned in the code pasted above?
