Trilinear interpolation is a method of
multivariate interpolation
In numerical analysis, multivariate interpolation or multidimensional interpolation is interpolation on ''multivariate functions'', having more than one variable or defined over a multi-dimensional domain. A common special case is bivariate inter ...
on a
3-dimensional regular grid
A regular grid is a tessellation of ''n''-dimensional Euclidean space by Congruence_(geometry), congruent parallelepiped#Parallelotope, parallelotopes (e.g. bricks). Its opposite is Unstructured grid, irregular grid.
Grids of this type appear on ...
. It approximates the value of a function at an intermediate point
within the local axial rectangular
prism linearly, using function data on the lattice points.
Trilinear interpolation is frequently used in
numerical analysis
Numerical analysis is the study of algorithms that use numerical approximation (as opposed to symbolic computation, symbolic manipulations) for the problems of mathematical analysis (as distinguished from discrete mathematics). It is the study of ...
,
data analysis
Data analysis is the process of inspecting, Data cleansing, cleansing, Data transformation, transforming, and Data modeling, modeling data with the goal of discovering useful information, informing conclusions, and supporting decision-making. Da ...
, and
computer graphics
Computer graphics deals with generating images and art with the aid of computers. Computer graphics is a core technology in digital photography, film, video games, digital art, cell phone and computer displays, and many specialized applications. ...
.
Related methods
Trilinear interpolation is the extension of
linear interpolation
In mathematics, linear interpolation is a method of curve fitting using linear polynomials to construct new data points within the range of a discrete set of known data points.
Linear interpolation between two known points
If the two known po ...
, which operates in spaces with
dimension
In physics and mathematics, the dimension of a mathematical space (or object) is informally defined as the minimum number of coordinates needed to specify any point within it. Thus, a line has a dimension of one (1D) because only one coo ...
, and
bilinear interpolation
In mathematics, bilinear interpolation is a method for interpolating functions of two variables (e.g., ''x'' and ''y'') using repeated linear interpolation. It is usually applied to functions sampled on a 2D rectilinear grid, though it can be ge ...
, which operates with dimension
, to dimension
. These interpolation schemes all use polynomials of order 1, giving an accuracy of order 2, and it requires
adjacent pre-defined values surrounding the interpolation point. There are several ways to arrive at trilinear interpolation, which is equivalent to 3-dimensional
tensor
In mathematics, a tensor is an algebraic object that describes a multilinear relationship between sets of algebraic objects associated with a vector space. Tensors may map between different objects such as vectors, scalars, and even other ...
B-spline
In numerical analysis, a B-spline (short for basis spline) is a type of Spline (mathematics), spline function designed to have minimal Support (mathematics), support (overlap) for a given Degree of a polynomial, degree, smoothness, and set of bre ...
interpolation of order 1, and the trilinear interpolation operator is also a tensor product of 3 linear interpolation operators.
For an arbitrary,
unstructured mesh (as used in
finite element analysis), other methods of interpolation must be used; if all the mesh elements are
tetrahedra
In geometry, a tetrahedron (: tetrahedra or tetrahedrons), also known as a triangular pyramid, is a polyhedron composed of four triangular Face (geometry), faces, six straight Edge (geometry), edges, and four vertex (geometry), vertices. The tet ...
(3D
simplices
In geometry, a simplex (plural: simplexes or simplices) is a generalization of the notion of a triangle or tetrahedron to arbitrary dimensions. The simplex is so-named because it represents the simplest possible polytope in any given dimension. ...
), then
barycentric coordinates provide a straightforward procedure.
Formulation
On a periodic and cubic lattice, let
,
, and
be the differences between each of
,
,
and the smaller coordinate related, that is:
:
where
indicates the lattice point below
, and
indicates the lattice point above
and similarly for
and
.
First one interpolates along
(imagine one is "pushing" the face of the cube defined by
to the opposing face, defined by
), giving:
:
Where
means the function value of
Then one interpolates these values (along
, "pushing" from
to
), giving:
:
Finally one interpolates these values along
(walking through a line):
:
This gives us a predicted value for the point.
The result of trilinear interpolation is independent of the order of the interpolation steps along the three axes: any other order, for instance along
, then along
, and finally along
, produces the same value.
Algorithm visualization

The above operations can be visualized as follows: First we find the eight corners of a cube that surround our point of interest. These corners have the values
,
,
,
,
,
,
,
.
Next, we perform linear interpolation between
and
to find
,
and
to find
,
and
to find
,
and
to find
.
Now we do interpolation between
and
to find
,
and
to find
. Finally, we calculate the value
via linear interpolation of
and
In practice, a trilinear interpolation is identical to two
bilinear interpolation
In mathematics, bilinear interpolation is a method for interpolating functions of two variables (e.g., ''x'' and ''y'') using repeated linear interpolation. It is usually applied to functions sampled on a 2D rectilinear grid, though it can be ge ...
combined with a linear interpolation:
:
Alternative algorithm
An alternative way to write the solution to the interpolation problem is
:
where the coefficients are found by solving the linear system
:
yielding the result
:
See also
*
Linear interpolation
In mathematics, linear interpolation is a method of curve fitting using linear polynomials to construct new data points within the range of a discrete set of known data points.
Linear interpolation between two known points
If the two known po ...
*
Bilinear interpolation
In mathematics, bilinear interpolation is a method for interpolating functions of two variables (e.g., ''x'' and ''y'') using repeated linear interpolation. It is usually applied to functions sampled on a 2D rectilinear grid, though it can be ge ...
*
Tricubic interpolation
In the mathematical subfield numerical analysis, tricubic interpolation is a method for obtaining values at arbitrary points in Three-dimensional space, 3D space of a function defined on a regular grid. The approach involves approximating the fun ...
*
Radial interpolation
*
Tetrahedral interpolation
*
Spherical linear interpolation
External links
pseudo-code from NASA describes an iterative inverse trilinear interpolation (given the vertices and the value of C find Xd, Yd and Zd).
*Paul Bourke
Interpolation methods 1999. Contains a very clever and simple method to find trilinear interpolation that is based on binary logic and can be extended to any dimension (Tetralinear, Pentalinear, ...).
*Kenwright, Free-Form Tetrahedron Deformation. International Symposium on Visual Computing. Springer International Publishing, 201
Multivariate interpolation
Euclidean solid geometry