Interpolation, Method -> "Voronoi"

Interpolation[funcvaluelist, Method→"Voronoi", (options)][x], where funcvaluelist is a list of scattered control points together with the function values in these points, returns the function value of the nearest control point to x. The function is thus constant in regions.     If two control points are at the same minimum distance, the function value of the first is returned.
  • To use Interpolation, Method→"Voronoi", you first need to load the Obtuse Package using Needs["Obtuse`"].
  • The following options can be given:
DistanceFunctionAutomaticdistance function to use in calculation of the distance matrix and the calculation of the distance from the interpolation point to the control points. Note, that the function here is expected to return the square of the distance
In[1]:=
Click for copyable input
Some 2D points:
In[2]:=
Click for copyable input
Add function values to the 2D point table:
In[3]:=
Click for copyable input
Test interpolation in one point:
In[4]:=
Click for copyable input
Out[4]=
Check with the original function in the same point:
In[5]:=
Click for copyable input
Out[5]=
If the same interpolation should be used in many different points, the function can be precompiled without specifying in which point it will be used. Not very much time is gained by this, in this case.
In[6]:=
Click for copyable input
Out[6]=