RectilinearGrid.interpolate(target, sharpness=2, radius=1.0, strategy='null_value', null_value=0.0, n_points=None, pass_cell_data=True, pass_point_data=True, progress_bar=False, **kwargs)#

Interpolate values onto this mesh from a given dataset.

The input dataset is typically a point cloud.

This uses a Gaussian interpolation kernel. Use the sharpness and radius parameters to adjust this kernel. You can also switch this kernel to use an N closest points approach.


The vtk data object to sample from. Point and cell arrays from this object are interpolated onto this mesh.

sharpnessfloat, optional

Set the sharpness (i.e., falloff) of the Gaussian kernel. By default sharpness=2. As the sharpness increases the effects of distant points are reduced.

radiusfloat, optional

Specify the radius within which the basis points must lie.

strategystr, optional

Specify a strategy to use when encountering a “null” point during the interpolation process. Null points occur when the local neighborhood (of nearby points to interpolate from) is empty. If the strategy is set to 'mask_points', then an output array is created that marks points as being valid (=1) or null (invalid =0) (and the NullValue is set as well). If the strategy is set to 'null_value' (this is the default), then the output data value(s) are set to the null_value (specified in the output point data). Finally, the strategy 'closest_point' is to simply use the closest point to perform the interpolation.

null_valuefloat, optional

Specify the null point value. When a null point is encountered then all components of each null tuple are set to this value. By default the null value is set to zero.

n_pointsint, optional

If given, specifies the number of the closest points used to form the interpolation basis. This will invalidate the radius argument in favor of an N closest points approach. This typically has poorer results.

pass_cell_databool, optional

Preserve input mesh’s original cell data arrays.

pass_point_databool, optional

Preserve input mesh’s original point data arrays.

progress_barbool, optional

Display a progress bar to indicate progress.

**kwargsdict, optional

Depreciated keyword arguments pass_cell_arrays and pass_point_arrays.


Interpolated dataset. Return type matches input.


Interpolate the values of 5 points onto a sample plane.

>>> import pyvista
>>> import numpy as np
>>> np.random.seed(7)
>>> point_cloud = np.random.random((5, 3))
>>> point_cloud[:, 2] = 0
>>> point_cloud -= point_cloud.mean(0)
>>> pdata = pyvista.PolyData(point_cloud)
>>> pdata['values'] = np.random.random(5)
>>> plane = pyvista.Plane()
>>> plane.clear_data()
>>> plane = plane.interpolate(pdata, sharpness=3)
>>> pl = pyvista.Plotter()
>>> _ = pl.add_mesh(pdata, render_points_as_spheres=True, point_size=50)
>>> _ = pl.add_mesh(plane, style='wireframe', line_width=5)

See Interpolating for more examples using this filter.