Professional Documents
Culture Documents
Multi-Linear Interpolation: 1 Abstract
Multi-Linear Interpolation: 1 Abstract
Multi-Linear Interpolation
Rick Wagner
1 Abstract
A standard linear algebra method of interpolation that scales to any dimensionality is
described.
2 Description
Given an array (or table) of values for a function of one or more variables, it is often
desired to find a value between two given points. If the given function is not linear, then
the interpolated value will be an approximation. Computation of error terms for the non-
linear case is covered in standard mathematics texts [1]. If the array has more than two
dimensions, the value sought will be at a point within the interior of the corresponding
polytope. In the descriptions below, the functions for interpolation are assumed to be
sufficiently close to linear.
Page 1
Beach Cities Robotics
FIRST Team 294
Y
B
y1
(x1, y1)
C
y2
(x2, y2)
A
y0
(x0, y0)
y = f(x)
x1 - x0
x2 - x0 x1 - x2
X
x0 x2 x1
Page 2
Beach Cities Robotics
FIRST Team 294
segments AC and CB to a unit segment. So equation (5) is saying that the interpolated
value, y2, is y0 times the normalized projection of segment CB plus y1 times the
normalized projection of segment AC. Note that the normalized segments that serve as
factors for the y-values of the vertices A and B are opposite from (not adjacent to) their
corresponding vertices. This interpretation of linear interpolation allows us to easily
extend it to higher dimensionality.
z = f(x, y)
A B
y1
(x0, y1, z0) (x1, y1, z1)
E
y2
(x2, y2, z4)
C D
y0
(x0, y0, z2) (x1, y0, z3)
X
x0 x2 x1
Page 3
Beach Cities Robotics
FIRST Team 294
The four normalized areas, Na, Nb, Nc, and Nd, each diagonally opposite from its naming
rectangle vertex, are given by
Na =
(x1 − x2 ) ⋅ ( y2 − y0 ) (7)
(x1 − x0 ) ⋅ ( y1 − y0 )
(x2 − x0 ) ⋅ ( y 2 − y 0 )
Nb = (8)
(x1 − x0 ) ⋅ ( y1 − y 0 )
(x1 − x 2 ) ⋅ ( y1 − y 2 )
Nc = (9)
(x1 − x0 ) ⋅ ( y1 − y 0 )
(x − x0 ) ⋅ ( y1 − y 2 )
Nd = 2 (10)
(x1 − x0 ) ⋅ ( y1 − y 0 )
Then z4 is computed by the equation
z 4 = z 0 ⋅ N a + z1 ⋅ N b + z 2 ⋅ N c + z 3 ⋅ N d (11)
Page 4
Beach Cities Robotics
FIRST Team 294
Z
v = f(x, y, z)
z1
z2
y1
(x1, y1, z0, v7) H
X Y
Na =
(x1 − x2 ) ⋅ ( y1 − y2 ) ⋅ (z2 − z0 ) (13)
(x1 − x0 ) ⋅ ( y1 − y0 ) ⋅ (z1 − z0 )
( x − x ) ⋅ ( y 2 − y0 ) ⋅ ( z 2 − z 0 )
Nb = 1 2 (14)
(x1 − x0 ) ⋅ ( y1 − y0 ) ⋅ (z1 − z0 )
Page 5
Beach Cities Robotics
FIRST Team 294
Nc =
(x2 − x0 ) ⋅ ( y1 − y2 ) ⋅ (z2 − z0 ) (15)
(x1 − x0 ) ⋅ ( y1 − y0 ) ⋅ (z1 − z0 )
(x − x0 ) ⋅ ( y2 − y0 ) ⋅ (z2 − z0 )
Nd = 2 (16)
(x1 − x0 ) ⋅ ( y1 − y0 ) ⋅ (z1 − z0 )
(x − x ) ⋅ ( y1 − y2 ) ⋅ (z1 − z2 )
Ne = 1 2 (17)
(x1 − x0 ) ⋅ ( y1 − y0 ) ⋅ (z1 − z0 )
(x − x ) ⋅ ( y2 − y0 ) ⋅ (z1 − z2 )
Nf = 1 2 (18)
(x1 − x0 ) ⋅ ( y1 − y0 ) ⋅ (z1 − z0 )
(x − x0 ) ⋅ ( y1 − y2 ) ⋅ (z1 − z2 )
Ng = 2 (19)
(x1 − x0 ) ⋅ ( y1 − y0 ) ⋅ (z1 − z0 )
(x − x0 ) ⋅ ( y2 − y0 ) ⋅ (z1 − z2 )
Nh = 2 (20)
(x1 − x0 ) ⋅ ( y1 − y0 ) ⋅ (z1 − z0 )
Then z8 is computed by the equation
z8 = z0 ⋅ N a + z1 ⋅ N b + z2 ⋅ N c + z3 ⋅ N d + z4 ⋅ N e + z5 ⋅ N f + z6 ⋅ N g + z7 ⋅ N h (21)
Page 6
Beach Cities Robotics
FIRST Team 294
(x12 − x10 ) ⋅ (x22 − x20 ) ⋅ K ⋅ (x n 2 − x n0 )
N 11K1 =
(x11 − x10 ) ⋅ (x21 − x20 ) ⋅ K ⋅ (x n1 − x n0 )
Where point (x10 , x 20 ,K , x n 0 ) is the polytope vertex nearest the origin and point
(x11 , x21 ,K, xn1 ) is the vertex farthest from the origin. The y-value of the point in the
interior of the polytope is given by
y = x1 ⋅ N 1 + x 2 ⋅ N 2 + K + x n ⋅ N n (24)
3 Conclusion
A generic n-dimensional linear interpolation method has been described with specific
low-dimensional examples.
4 References
[1] Kreysig, Erwin, Advanced Engineering Mathematics, Third Edition, John Wiley and Sons, Inc.,
1972.
[2] Safro, Ilya, “Resampling Using Bilinear Interpolation,” Web page:
http://www.wisdom.weizmann.ac.il/~maksimf/ex5/Resample.html, 2004.
Page 7