Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I have a 2D space that I can query that is between [0,0] and [1,1].

At each location in space is a data point X which is in R^2.

I have 3 known values at

{x1, y1} = D1 {x2, y2} = D2 {x3, y3} = D3

where {xn, yn) is between 0 and 1

My question is, if given a value {u,v} that is each in the range of [0,1] can I interpolate D1, D2, and D3 to give me a value Duv?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

Let us write $v_i = (x_i, y_i)$ for $1 \le i \le 3$. If $v_1$, $v_2$, $v_3$ are affine independent (i. e. there is no line containing all three of them), we can compute the (uniquely determined) affine function $f\colon \mathbb R^2 \to \mathbb R$ with $f(v_i) = D_i$ for $1 \le i \le 3$ an use it to interpolate other values. $f$ can be computed as follows:

As an affine function, $f$ has the form $f(x,y) = ax+by+c$, $a$, $b$, $c$ to be determined, so we plug in what we know giving a linear system of equations \begin{align*} ax_1 + by_1 + c &= D_1\\ ax_2 + by_2 + c &= D_2\\ ax_3 + by_3 + c &= D_3 \end{align*} Under our assumptions on the $v_i$, the equations have a unique solution $(a,b,c)$.

-- Edit:

So I'll try to add something more about the "why". You should think about the one-dimensional case, that is: given points $x_1$, $x_2\in \mathbb R$, and same values $D_1$, $D_2$, we try to inter- or extrapolate the value at some other point $x$. To do this, we find the line connecting the points $(x_1, D_1)$ and $(x_2, D_2)$ in the plane and take it as a graph of a affine-linear function $f\colon\mathbb R \to \mathbb R$, and interpolate at $x$ by computing the value $f(x)$.

We follow this well known (I hope so) procedure in our two-dimensional case. The analogon of the line in 1D is a plane, and indeed: The graph of an affine-linear function $f\colon \mathbb R^2 \to \mathbb R$ is a plane. The equation of such a plane is $f(x,y) = ax + by + c$, that is to dertermine our plane we need to compute $a$, $b$ and $c$. As we want $f$ to interpolate the given values, we need $f(x_i, y_i) = D_i$, $1 \le i \le 3$. We compute them as above (solving the linear system $f(x_i, y_i) = D_i$). Then we just interpolate by evaluating $f$ (as we did in 1D).

share|improve this answer
    
martini: Thank you for the answer. This works well but I was wondering if you could also help me with intuition on why this works? I can see that the math but I don't understand why this works. –  coderdave Jun 27 '12 at 17:54
    
@coderdave This works. –  martini Jun 27 '12 at 19:14
    
thank you for your explanation –  coderdave Jun 27 '12 at 21:10
    
does this concept extend when D is a point in $R^3$? –  coderdave Jun 27 '12 at 21:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.