# Trilinear interpolation

Trilinear interpolation is the process of taking a three-dimensional set of numbers and interpolating the values linearly, finding a point using a weighted average of eight values.

 Contents

## Overview

The idea behind three-dimensional interpolation is that having some periodic volume of discrete data you can predict the value of a non-integer [itex]x, y, z[itex] within the plane. This is done using data for integer coordinate positions in the plane and using this, the aim is to try to predict a value for these non-integer [itex]x, y, z[itex] positions.

## Differences from linear interpolation and bilinear interpolation

• Trilinear interpolation works over a volume of numbers rather than
• Linear which works over a line of values
• Bilinear which works over a plane of values
• Trilinear interpolation works with eight values (these are the integer coordinate positions surrounding the point)

## Example

In order to trilinearly interpolate we need to look at the eight values surrounding the value we want. Let

[itex]x_f, y_f, z_f[itex]

be the fractional parts of

[itex]x, y, z[itex],

that is:

[itex]x_f = x - \lfloor x \rfloor[itex]
[itex]y_f = y - \lfloor y \rfloor[itex]
[itex]z_f = z - \lfloor z \rfloor[itex]

First we interpolate along [itex]z[itex], giving:

[itex]i_1 = v[\lfloor x \rfloor,\lfloor y \rfloor, \lfloor z \rfloor] \times (1 - z_f) + v[\lfloor x \rfloor, \lfloor y \rfloor, \lceil z \rceil] \times z_f[itex]
[itex]i_2 = v[\lfloor x \rfloor,\lceil y \rceil, \lfloor z \rfloor] \times (1 - z_f) + v[\lfloor x \rfloor, \lceil y \rceil, \lceil z \rceil] \times z_f[itex]
[itex]j_1 = v[\lceil x \rceil,\lfloor y \rfloor, \lfloor z \rfloor] \times (1 - z_f) + v[\lceil x \rceil, \lfloor y \rfloor, \lceil z \rceil] \times z_f[itex]
[itex]j_2 = v[\lceil x \rceil,\lceil y \rceil, \lfloor z \rfloor] \times (1 - z_f) + v[\lceil x \rceil, \lceil y \rceil, \lceil z \rceil] \times z_f.[itex]

Then we interpolate these values (along [itex]y[itex]), giving:

[itex]w_1 = i_1(1 - y_f) + i_2y_f[itex]
[itex]w_2 = j_1(1 - y_f) + j_2y_f[itex]

Finally we interpolate these value along [itex]x[itex]:

[itex]IV = w_1(1 - x_f) + w_2x_f .[itex]

This gives us a predicted value for the point.

Note that the result of trilinear interpolation is independent of the order of interpolation, that is, performing the linear interpolations in the other order, along [itex]x[itex], along [itex]y[itex], then along [itex]z[itex] horizontally, would also produce an equivalent expression for the predicted value.

• Art and Cultures
• Countries of the World (http://www.academickids.com/encyclopedia/index.php/Countries)
• Space and Astronomy