Bilinear Interpolation Calculator
Calculate bilinear interpolation between four grid points. Visualize the 2D interpolation field with intermediate values R₁ and R₂.
About
Bilinear interpolation estimates a value f(x, y) at an arbitrary point within a rectangular grid defined by four known corner values. It performs three linear interpolations: two along one axis to produce intermediate values R1 and R2, then one along the perpendicular axis to yield the final result. The method assumes the function varies linearly between sample points, which introduces error proportional to the second derivative of the true surface. Misapplying it to non-rectilinear grids or extrapolating outside the cell produces incorrect results without warning. This calculator enforces strict domain checks: the interpolation point must lie within or on the boundary of the rectangle [x1, x2] × [y1, y2].
Applications span image resampling (where corner values are pixel intensities), GIS terrain modeling (elevation grids), computational fluid dynamics (pressure or velocity fields), and climate data interpolation (temperature at unsampled coordinates). The tool assumes a rectilinear grid with x1 ≠ x2 and y1 ≠ y2. For irregular point distributions, consider inverse distance weighting or kriging instead.
Formulas
Given four corner values on a rectilinear grid at coordinates (x1, y1), (x2, y1), (x1, y2), and (x2, y2), the interpolated value at point (x, y) is computed in two stages.
First, compute normalized distances:
Interpolate along the x-axis at each y level:
Then interpolate along the y-axis:
Equivalently, the full expanded form:
Where: Q11 = f(x1, y1) is the value at the bottom-left corner. Q21 = f(x2, y1) is the bottom-right. Q12 = f(x1, y2) is the top-left. Q22 = f(x2, y2) is the top-right. t and u are the normalized interpolation parameters, each ∈ [0, 1].
Reference Data
| Interpolation Method | Dimensions | Required Points | Continuity | Typical Use Case | Error Order |
|---|---|---|---|---|---|
| Nearest Neighbor | Any | 1 | C−1 (discontinuous) | Fast image scaling, classification | O(h) |
| Linear (1D) | 1D | 2 | C0 | Signal resampling, table lookup | O(h2) |
| Bilinear | 2D | 4 | C0 | Image scaling, terrain grids, CFD | O(h2) |
| Trilinear | 3D | 8 | C0 | Volumetric data, 3D textures | O(h2) |
| Bicubic | 2D | 16 | C1 | Photo resampling, smooth surfaces | O(h4) |
| Cubic Spline (1D) | 1D | 4 | C2 | Smooth curve fitting, CAD | O(h4) |
| Lanczos | 1D/2D | 6-12 | C0 | High-quality image downscaling | O(h4) |
| Inverse Distance Weighting | Any | n | C0 | Irregular point clouds, GIS | Data-dependent |
| Kriging | 2D/3D | n | C0 | Geostatistics, mineral exploration | Optimal (BLUE) |
| Radial Basis Function | Any | n | C∞ | Mesh-free methods, scattered data | Spectral |
| Barycentric (Triangle) | 2D | 3 | C0 | FEM, triangulated surfaces | O(h2) |
| Hermite | 1D/2D | 4 + derivatives | C1 | Animation, smooth motion paths | O(h4) |
| B-Spline (Quadratic) | 1D/2D | 9 | C1 | CAD surfaces, font rendering | O(h3) |
| Shepard’s Method | Any | n | C0 | Quick scattered data approx. | Data-dependent |