Nearest neighbour
Every position is assigned the value of the closest support point. This creates constant sections with jumps halfway between two points.
Learning aid for clearer understanding
Adjust five support values and see immediately how nearest-neighbour, linear and shape-preserving cubic interpolation represent the same data sequence in different ways.
All calculations are performed locally in your browser.
Open the advanced interpolation comparison with freely selectable exploration points, layer profiles and area comparison.
Use the sliders or drag the points vertically in the chart. The normalised values are intended solely for comparing the methods.
You can also drag the marked support points directly up or down.
Each method makes a different assumption about the progression between known support points.
Every position is assigned the value of the closest support point. This creates constant sections with jumps halfway between two points.
Adjacent support points are joined by straight lines. The result is easy to follow, but has corners at the support points.
PCHIP connects piecewise cubic polynomials and derives slopes from adjacent secants. Monotonic data sections remain monotonic, avoiding typical overshoot.